diff --git a/core/modules/block_content/config/schema/block_content.views.schema.yml b/core/modules/block_content/config/schema/block_content.views.schema.yml new file mode 100644 index 0000000..af39d53 --- /dev/null +++ b/core/modules/block_content/config/schema/block_content.views.schema.yml @@ -0,0 +1,18 @@ +# Schema for the views plugins of the Block Content module. + +# @todo Fix this when https://www.drupal.org/node/2322949 is fixed. +views.field.block_content: + type: views_field + label: 'Block Content' + mapping: + link_to_entity: + type: boolean + label: 'Link this field to the original piece of block content' + +views.field.block_content_type: + type: views.field.block_content + label: 'Block content type' + mapping: + machine_name: + type: string + label: 'Output machine name' diff --git a/core/modules/block_content/src/BlockContentViewsData.php b/core/modules/block_content/src/BlockContentViewsData.php new file mode 100644 index 0000000..7950d78 --- /dev/null +++ b/core/modules/block_content/src/BlockContentViewsData.php @@ -0,0 +1,67 @@ +moduleHandler->moduleExists('content_translation')) { + $data['block_content']['translation_link'] = array( + 'title' => $this->t('Translation link'), + 'help' => $this->t('Provide a link to the translations overview for custom blocks.'), + 'field' => array( + 'id' => 'content_translation_link', + ), + ); + } + + // Advertise this table as a possible base table. + $data['block_content_revision']['table']['base']['help'] = $this->t('Block Content revision is a history of changes to block content.'); + $data['block_content_revision']['table']['base']['defaults']['title'] = 'info'; + + // @todo EntityViewsData should add these relationships by default. + // https://www.drupal.org/node/2410275 + $data['block_content_revision']['id']['relationship']['id'] = 'standard'; + $data['block_content_revision']['id']['relationship']['base'] = 'block_content'; + $data['block_content_revision']['id']['relationship']['base field'] = 'id'; + $data['block_content_revision']['id']['relationship']['title'] = $this->t('Block Content'); + $data['block_content_revision']['id']['relationship']['label'] = $this->t('Get the actual block content from a block content revision.'); + + $data['block_content_revision']['revision_id']['relationship']['id'] = 'standard'; + $data['block_content_revision']['revision_id']['relationship']['base'] = 'block_content'; + $data['block_content_revision']['revision_id']['relationship']['base field'] = 'revision_id'; + $data['block_content_revision']['revision_id']['relationship']['title'] = $this->t('Block Content'); + $data['block_content_revision']['revision_id']['relationship']['label'] = $this->t('Get the actual block content from a block content revision.'); + + $data['block_content_revision']['revision_log']['field']['id'] = 'xss'; + + return $data; + + } + +} diff --git a/core/modules/block_content/src/Entity/BlockContent.php b/core/modules/block_content/src/Entity/BlockContent.php index ef48ac6..469c314 100644 --- a/core/modules/block_content/src/Entity/BlockContent.php +++ b/core/modules/block_content/src/Entity/BlockContent.php @@ -26,6 +26,7 @@ * "access" = "Drupal\block_content\BlockContentAccessControlHandler", * "list_builder" = "Drupal\block_content\BlockContentListBuilder", * "view_builder" = "Drupal\block_content\BlockContentViewBuilder", + * "views_data" = "Drupal\block_content\BlockContentViewsData", * "form" = { * "add" = "Drupal\block_content\BlockContentForm", * "edit" = "Drupal\block_content\BlockContentForm", diff --git a/core/modules/block_content/src/Plugin/views/field/BlockContent.php b/core/modules/block_content/src/Plugin/views/field/BlockContent.php new file mode 100644 index 0000000..03baa24 --- /dev/null +++ b/core/modules/block_content/src/Plugin/views/field/BlockContent.php @@ -0,0 +1,158 @@ +languageManager = $language_manager; + $this->entityManager = $entity_manager; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $container->get('language_manager'), + $container->get('entity.manager') + ); + } + + /** + * {@inheritdoc} + */ + public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { + parent::init($view, $display, $options); + + // Don't add the additional fields to groupby + if (!empty($this->options['link_to_entity'])) { + $this->additional_fields['id'] = array('table' => 'block_content', 'field' => 'id'); + } + } + + /** + * {@inheritdoc} + */ + protected function defineOptions() { + $options = parent::defineOptions(); + $options['link_to_entity'] = array('default' => isset($this->definition['link_to_entity default']) ? $this->definition['link_to_entity default'] : FALSE); + return $options; + } + + /** + * {@inheritdoc} + */ + public function buildOptionsForm(&$form, FormStateInterface $form_state) { + $form['link_to_entity'] = array( + '#title' => $this->t('Link this field to the original piece of block content'), + '#description' => $this->t("Enable to override this field's links."), + '#type' => 'checkbox', + '#default_value' => !empty($this->options['link_to_entity']), + ); + + parent::buildOptionsForm($form, $form_state); + } + + /** + * Prepares link to the block_content. + * + * @param string $data + * The XSS safe string for the link text. + * @param \Drupal\views\ResultRow $values + * The values retrieved from a single row of a view's query result. + * + * @return string + * Returns a string for the link text. + */ + protected function renderLink($data, ResultRow $values) { + if (!empty($this->options['link_to_entity']) && !empty($this->additional_fields['id'])) { + if ($data !== NULL && $data !== '') { + $id = $this->getValue($values, 'id'); + $block_content = $this->entityManager->getStorage('block_content')->load($id); + $this->options['alter']['make_link'] = TRUE; + $this->options['alter']['path'] = $block_content->url(); + if (isset($this->aliases['langcode'])) { + $languages = $this->languageManager->getLanguages(); + $langcode = $this->getValue($values, 'langcode'); + if (isset($languages[$langcode])) { + $this->options['alter']['language'] = $languages[$langcode]; + } + else { + unset($this->options['alter']['language']); + } + } + } + else { + $this->options['alter']['make_link'] = FALSE; + } + } + return $data; + } + + /** + * {@inheritdoc} + */ + public function render(ResultRow $values) { + $value = $this->getValue($values); + return $this->renderLink($this->sanitizeValue($value), $values); + } + +} diff --git a/core/modules/block_content/src/Plugin/views/field/Type.php b/core/modules/block_content/src/Plugin/views/field/Type.php new file mode 100644 index 0000000..969d084 --- /dev/null +++ b/core/modules/block_content/src/Plugin/views/field/Type.php @@ -0,0 +1,75 @@ + FALSE); + + return $options; + } + + /** + * {@inheritdoc} + */ + public function buildOptionsForm(&$form, FormStateInterface $form_state) { + parent::buildOptionsForm($form, $form_state); + + $form['machine_name'] = array( + '#title' => $this->t('Output machine name'), + '#description' => $this->t('Display field as the block content type machine name.'), + '#type' => 'checkbox', + '#default_value' => !empty($this->options['machine_name']), + ); + } + + /** + * Renders block content type name. + * + * @param string $data + * The block content type machine_name. + * @param \Drupal\views\ResultRow $values + * The values retrieved from a single row of a view's query result. + * + * @return string + * The block content type as human readable name or machine_name. + */ + public function renderName($data, ResultRow $values) { + if ($this->options['machine_name'] != 1 && $data !== NULL && $data !== '') { + $type = $this->entityManager->getStorage('block_content_type')->load($data); + return $type ? $this->t($this->sanitizeValue($type->label())) : ''; + } + return $this->sanitizeValue($data); + } + + /** + * {@inheritdoc} + */ + public function render(ResultRow $values) { + $value = $this->getValue($values); + return $this->renderLink($this->renderName($value, $values), $values); + } + +} diff --git a/core/modules/block_content/src/Tests/Views/BlockContentFieldFilterTest.php b/core/modules/block_content/src/Tests/Views/BlockContentFieldFilterTest.php new file mode 100644 index 0000000..5ca1a5b --- /dev/null +++ b/core/modules/block_content/src/Tests/Views/BlockContentFieldFilterTest.php @@ -0,0 +1,113 @@ +save(); + ConfigurableLanguage::createFromLangcode('es')->save(); + + // Make the body field translatable. The info is already translatable by + // definition. + $field_storage = FieldStorageConfig::loadByName('block_content', 'body'); + $field_storage->translatable = TRUE; + $field_storage->save(); + + // Set up block_content infos. + $this->block_content_infos = array( + 'en' => 'Food in Paris', + 'es' => 'Comida en Paris', + 'fr' => 'Nouriture en Paris', + ); + + // Create block_content with translations. + $block_content = $this->createBlockContent(array('info' => $this->block_content_infos['en'], 'langcode' => 'en', 'type' => 'basic', 'body' => array(array('value' => $this->block_content_infos['en'])))); + foreach (array('es', 'fr') as $langcode) { + $translation = $block_content->addTranslation($langcode, array('info' => $this->block_content_infos[$langcode])); + $translation->body->value = $this->block_content_infos[$langcode]; + } + $block_content->save(); + } + + /** + * Tests body and info filters. + */ + public function testFilters() { + // Test the info filter page, which filters for info contains 'Comida'. + // Should show just the Spanish translation, once. + $this->assertPageCounts('test-info-filter', array('es' => 1, 'fr' => 0, 'en' => 0), 'Comida info filter'); + + // Test the body filter page, which filters for body contains 'Comida'. + // Should show just the Spanish translation, once. + $this->assertPageCounts('test-body-filter', array('es' => 1, 'fr' => 0, 'en' => 0), 'Comida body filter'); + + // Test the info Paris filter page, which filters for info contains + // 'Paris'. Should show each translation once. + $this->assertPageCounts('test-info-paris', array('es' => 1, 'fr' => 1, 'en' => 1), 'Paris info filter'); + + // Test the body Paris filter page, which filters for body contains + // 'Paris'. Should show each translation once. + $this->assertPageCounts('test-body-paris', array('es' => 1, 'fr' => 1, 'en' => 1), 'Paris body filter'); + } + + /** + * Asserts that the given block_content translation counts are correct. + * + * @param string $path + * Path of the page to test. + * @param array $counts + * Array whose keys are languages, and values are the number of times + * that translation should be shown on the given page. + * @param string $message + * Message suffix to display. + */ + protected function assertPageCounts($path, $counts, $message) { + // Get the text of the page. + $this->drupalGet($path); + $text = $this->getTextContent(); + + foreach ($counts as $langcode => $count) { + $this->assertEqual(substr_count($text, $this->block_content_infos[$langcode]), $count, 'Translation ' . $langcode . ' has count ' . $count . ' with ' . $message); + } + } +} diff --git a/core/modules/block_content/src/Tests/Views/BlockContentIntegrationTest.php b/core/modules/block_content/src/Tests/Views/BlockContentIntegrationTest.php new file mode 100644 index 0000000..02eff7f --- /dev/null +++ b/core/modules/block_content/src/Tests/Views/BlockContentIntegrationTest.php @@ -0,0 +1,72 @@ +createBlockContentType(); + $types[] = $type; + + for ($j = 0; $j < 5; $j++) { + // Ensure the right order of the block_contents. + $block_content = $this->createBlockContent(array('type' => $type->id())); + $block_contents[$type->id()][$block_content->id()] = $block_content; + $all_ids[] = $block_content->id(); + } + } + + $this->drupalGet('test-block_content-view'); + $this->assertResponse(404); + + $this->drupalGet('test-block_content-view/all'); + $this->assertResponse(200); + $this->assertIds($all_ids); + /* @var \Drupal\block_content\Entity\BlockContentType[] $types*/ + foreach ($types as $type) { + $this->drupalGet("test-block_content-view/{$type->id()}"); + $this->assertIds(array_keys($block_contents[$type->id()])); + } + } + + /** + * Ensures that a list of block_contents appear on the page. + * + * @param array $expected_ids + * An array of block_content IDs. + */ + protected function assertIds(array $expected_ids = array()) { + $result = $this->xpath('//span[@class="field-content"]'); + $ids = array(); + foreach ($result as $element) { + $ids[] = (int) $element; + } + $this->assertEqual($ids, $expected_ids); + } + +} diff --git a/core/modules/block_content/src/Tests/Views/BlockContentTestBase.php b/core/modules/block_content/src/Tests/Views/BlockContentTestBase.php new file mode 100644 index 0000000..83dc590 --- /dev/null +++ b/core/modules/block_content/src/Tests/Views/BlockContentTestBase.php @@ -0,0 +1,111 @@ +createBlockContentType(array('id' => 'basic')); + + $this->adminUser = $this->drupalCreateUser($this->permissions); + + if ($import_test_views) { + ViewTestData::createTestViews(get_class($this), array('block_content_test_views')); + } + } + + /** + * Creates a custom block. + * + * @param array $settings + * (optional) An associative array of settings for the block_content, as + * used in entity_create(). + * + * @return \Drupal\block_content\Entity\BlockContent + * Created custom block. + */ + protected function createBlockContent(array $settings = array()) { + $status = 0; + $settings += array( + 'info' => $this->randomMachineName(), + 'type' => 'basic', + 'langcode' => 'en', + ); + if ($block_content = entity_create('block_content', $settings)) { + $status = $block_content->save(); + } + $this->assertEqual($status, SAVED_NEW, String::format('Created block content %info.', array('%info' => $block_content->label()))); + return $block_content; + } + + /** + * Creates a custom block type (bundle). + * + * @param array $values + * An array of settings to change from the defaults. + * + * @return \Drupal\block_content\Entity\BlockContentType + * Created custom block type. + */ + protected function createBlockContentType(array $values = array()) { + // Find a non-existent random type name. + if (!isset($values['id'])) { + do { + $id = strtolower($this->randomMachineName(8)); + } while (BlockContentType::load($id)); + } + else { + $id = $values['id']; + } + $values += array( + 'id' => $id, + 'label' => $id, + 'revision' => FALSE + ); + $bundle = entity_create('block_content_type', $values); + $status = $bundle->save(); + block_content_add_body_field($bundle->id()); + + $this->assertEqual($status, SAVED_NEW, String::format('Created block content type %bundle.', array('%bundle' => $bundle->id()))); + return $bundle; + } + +} diff --git a/core/modules/block_content/src/Tests/Views/FieldTypeTest.php b/core/modules/block_content/src/Tests/Views/FieldTypeTest.php new file mode 100644 index 0000000..301fa45 --- /dev/null +++ b/core/modules/block_content/src/Tests/Views/FieldTypeTest.php @@ -0,0 +1,42 @@ +createBlockContent(); + $expected_result[] = array( + 'id' => $block_content->id(), + 'block_content_field_data_type' => $block_content->bundle(), + ); + $column_map = array( + 'id' => 'id', + 'block_content_field_data_type' => 'block_content_field_data_type', + ); + + $view = Views::getView('test_field_type'); + $this->executeView($view); + $this->assertIdenticalResultset($view, $expected_result, $column_map, 'The correct block_content type was displayed.'); + } + +} diff --git a/core/modules/block_content/src/Tests/Views/RevisionRelationshipsTest.php b/core/modules/block_content/src/Tests/Views/RevisionRelationshipsTest.php new file mode 100644 index 0000000..a7ecabe --- /dev/null +++ b/core/modules/block_content/src/Tests/Views/RevisionRelationshipsTest.php @@ -0,0 +1,96 @@ + 'basic', + 'label' => 'basic', + 'revision' => TRUE, + )); + ViewTestData::createTestViews(get_class($this), array('block_content_test_views')); + } + + /** + * Create a block_content with revision and rest result count for both views. + */ + public function testBlockContentRevisionRelationship() { + $block_content = BlockContent::create(array( + 'info' => $this->randomMachineName(), + 'type' => 'basic', + 'langcode' => 'en', + )); + $block_content->save(); + // Create revision of the block_content. + $block_content_revision = clone $block_content; + $block_content_revision->setNewRevision(); + $block_content_revision->save(); + $column_map = array( + 'revision_id' => 'revision_id', + 'block_content_revision_id' => 'block_content_revision_id', + 'block_content_block_content_revision_id' => 'block_content_block_content_revision_id', + ); + + // Here should be two rows. + $view_id = Views::getView('test_block_content_revision_id'); + $this->executeView($view_id, array($block_content->id())); + $resultset_id = array( + array( + 'revision_id' => '1', + 'block_content_revision_id' => '1', + 'block_content_block_content_revision_id' => '1', + ), + array( + 'revision_id' => '2', + 'block_content_revision_id' => '1', + 'block_content_block_content_revision_id' => '1', + ), + ); + $this->assertIdenticalResultset($view_id, $resultset_id, $column_map); + + // There should be only one row with active revision 2. + $view_revision_id = Views::getView('test_block_content_revision_revision_id'); + $this->executeView($view_revision_id, array($block_content->id())); + $resultset_revision_id = array( + array( + 'revision_id' => '2', + 'block_content_revision_id' => '1', + 'block_content_block_content_revision_id' => '1', + ), + ); + $this->assertIdenticalResultset($view_revision_id, $resultset_revision_id, $column_map); + } + +} diff --git a/core/modules/block_content/tests/modules/block_content_test_views/block_content_test_views.info.yml b/core/modules/block_content/tests/modules/block_content_test_views/block_content_test_views.info.yml new file mode 100644 index 0000000..43b58c1 --- /dev/null +++ b/core/modules/block_content/tests/modules/block_content_test_views/block_content_test_views.info.yml @@ -0,0 +1,9 @@ +name: 'Block Content test views' +type: module +description: 'Provides default views for views block_content tests.' +package: Testing +version: VERSION +core: 8.x +dependencies: + - block_content + - views diff --git a/core/modules/block_content/tests/modules/block_content_test_views/test_views/views.view.test_block_content_revision_id.yml b/core/modules/block_content/tests/modules/block_content_test_views/test_views/views.view.test_block_content_revision_id.yml new file mode 100644 index 0000000..c872156 --- /dev/null +++ b/core/modules/block_content/tests/modules/block_content_test_views/test_views/views.view.test_block_content_revision_id.yml @@ -0,0 +1,60 @@ +langcode: und +status: true +dependencies: + module: + - block_content +id: test_block_content_revision_id +label: null +module: views +description: '' +tag: '' +base_table: block_content_revision +base_field: revision_id +core: '8' +display: + default: + display_options: + relationships: + id: + id: id + table: block_content_revision + field: id + required: true + plugin_id: standard + fields: + revision_id: + id: revision_id + table: block_content_revision + field: revision_id + plugin_id: numeric + entity_type: block_content + entity_field: revision_id + id_1: + id: id_1 + table: block_content_revision + field: id + plugin_id: standard + entity_type: block_content + entity_field: id + id: + id: id + table: block_content + field: id + relationship: id + plugin_id: block_content + entity_type: block_content + entity_field: id + arguments: + id: + id: id + table: block_content_revision + field: id + plugin_id: numeric + entity_type: block_content + entity_field: id + field_langcode: '***LANGUAGE_language_content***' + field_langcode_add_to_query: null + display_plugin: default + display_title: Master + id: default + position: 0 diff --git a/core/modules/block_content/tests/modules/block_content_test_views/test_views/views.view.test_block_content_revision_revision_id.yml b/core/modules/block_content/tests/modules/block_content_test_views/test_views/views.view.test_block_content_revision_revision_id.yml new file mode 100644 index 0000000..7d35c4c --- /dev/null +++ b/core/modules/block_content/tests/modules/block_content_test_views/test_views/views.view.test_block_content_revision_revision_id.yml @@ -0,0 +1,63 @@ +langcode: und +status: true +dependencies: + module: + - block_content +id: test_block_content_revision_revision_id +label: null +module: views +description: '' +tag: '' +base_table: block_content_revision +base_field: revision_id +core: '8' +display: + default: + display_options: + relationships: + revision_id: + id: revision_id + table: block_content_revision + field: revision_id + required: true + entity_type: block_content + entity_field: revision_id + plugin_id: standard + fields: + revision_id: + id: revision_id + table: block_content_revision + field: revision_id + plugin_id: standard + entity_type: block_content + entity_field: revision_id + id_1: + id: id_1 + table: block_content_revision + field: id + plugin_id: standard + entity_type: block_content + entity_field: id + id: + id: id + table: block_content + field: id + relationship: revision_id + plugin_id: block_content + entity_type: block_content + entity_field: id + arguments: + id: + id: id + table: block_content_revision + field: id + plugin_id: block_content_id + entity_type: block_content + entity_field: id + field_langcode: '***LANGUAGE_language_content***' + field_langcode_add_to_query: null + display_extenders: { } + display_plugin: default + display_title: Master + id: default + position: 0 diff --git a/core/modules/block_content/tests/modules/block_content_test_views/test_views/views.view.test_block_content_view.yml b/core/modules/block_content/tests/modules/block_content_test_views/test_views/views.view.test_block_content_view.yml new file mode 100644 index 0000000..198e9ce --- /dev/null +++ b/core/modules/block_content/tests/modules/block_content_test_views/test_views/views.view.test_block_content_view.yml @@ -0,0 +1,183 @@ +langcode: en +status: true +dependencies: + module: + - block_content +id: test_block_content_view +label: test_block_content_view +module: views +description: '' +tag: '' +base_table: block_content +base_field: id +core: 8.x +display: + default: + display_plugin: default + id: default + display_title: Master + position: null + display_options: + access: + type: none + options: { } + cache: + type: none + options: { } + query: + type: views_query + options: + disable_sql_rewrite: false + distinct: false + replica: false + query_comment: false + query_tags: { } + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + pager: + type: full + options: + items_per_page: 10 + offset: 0 + id: 0 + total_pages: null + expose: + items_per_page: false + items_per_page_label: 'Items per page' + items_per_page_options: '5, 10, 25, 50' + items_per_page_options_all: false + items_per_page_options_all_label: '- All -' + offset: false + offset_label: Offset + tags: + previous: '‹ previous' + next: 'next ›' + first: '« first' + last: 'last »' + quantity: 9 + style: + type: default + row: + type: fields + fields: + id: + id: id + table: block_content + field: id + relationship: none + group_type: group + admin_label: '' + label: Id + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: '' + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + link_to_entity: false + plugin_id: block_content + entity_type: block_content + entity_field: id + sorts: { } + title: test_block_content_view + header: { } + footer: { } + empty: { } + relationships: { } + field_langcode: '***LANGUAGE_language_content***' + field_langcode_add_to_query: null + display_extenders: { } + arguments: + type: + id: type + table: block_content + field: type + relationship: none + group_type: group + admin_label: '' + default_action: 'not found' + exception: + value: all + title_enable: false + title: All + title_enable: false + title: '' + default_argument_type: fixed + default_argument_options: + argument: '' + default_argument_skip_url: false + summary_options: + base_path: '' + count: true + items_per_page: 25 + override: false + summary: + sort_order: asc + number_of_records: 0 + format: default_summary + specify_validation: false + validate: + type: none + fail: 'not found' + validate_options: { } + glossary: false + limit: 0 + case: none + path_case: none + transform_dash: false + break_phrase: false + entity_type: block_content + entity_field: type + plugin_id: string + page_1: + display_plugin: page + id: page_1 + display_title: Page + position: null + display_options: + path: test-block_content-view + field_langcode: '***LANGUAGE_language_content***' + field_langcode_add_to_query: null + display_extenders: { } diff --git a/core/modules/block_content/tests/modules/block_content_test_views/test_views/views.view.test_field_filters.yml b/core/modules/block_content/tests/modules/block_content_test_views/test_views/views.view.test_field_filters.yml new file mode 100644 index 0000000..f4edfd8 --- /dev/null +++ b/core/modules/block_content/tests/modules/block_content_test_views/test_views/views.view.test_field_filters.yml @@ -0,0 +1,347 @@ +langcode: en +status: true +dependencies: + module: + - block_content +id: test_field_filters +label: 'Test field filters' +module: views +description: '' +tag: '' +base_table: block_content +base_field: id +core: 8.x +display: + default: + display_plugin: default + id: default + display_title: Master + position: 0 + display_options: + access: + type: none + options: { } + cache: + type: none + options: { } + query: + type: views_query + options: + disable_sql_rewrite: false + distinct: false + replica: false + query_comment: false + query_tags: { } + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + pager: + type: none + options: + items_per_page: 0 + offset: 0 + style: + type: default + row: + type: 'entity:block_content' + options: + relationship: none + view_mode: default + fields: + info: + id: info + table: block_content_field_data + field: info + label: '' + alter: + alter_text: false + make_link: false + absolute: false + trim: false + word_boundary: false + ellipsis: false + strip_tags: false + html: false + hide_empty: false + empty_zero: false + link_to_entity: true + relationship: none + group_type: group + admin_label: '' + exclude: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_alter_empty: true + entity_type: block_content + entity_field: title + plugin_id: block_content + filters: + info: + id: info + table: block_content_field_data + field: info + relationship: none + group_type: group + admin_label: '' + operator: contains + value: Paris + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + plugin_id: string + entity_type: block_content + entity_field: info + sorts: + changed: + id: changed + table: block_content_field_data + field: changed + order: DESC + relationship: none + group_type: group + admin_label: '' + exposed: false + expose: + label: '' + granularity: second + plugin_id: date + entity_type: block_content + entity_field: changed + title: 'Test field filters' + header: { } + footer: { } + empty: { } + relationships: { } + arguments: { } + field_langcode: '***LANGUAGE_language_content***' + field_langcode_add_to_query: null + rendering_language: translation_language_renderer + display_extenders: { } + page_bf: + display_plugin: page + id: page_bf + display_title: 'Body filter page' + position: 1 + display_options: + field_langcode: '***LANGUAGE_language_content***' + field_langcode_add_to_query: null + path: test-body-filter + display_description: '' + title: 'Test body filters' + defaults: + title: false + filters: false + filter_groups: false + filters: + body_value: + id: body_value + table: block_content__body + field: body_value + relationship: none + group_type: group + admin_label: '' + operator: contains + value: Comida + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + plugin_id: string + entity_type: block_content + entity_field: body + filter_groups: + operator: AND + groups: + 1: AND + display_extenders: { } + page_bfp: + display_plugin: page + id: page_bfp + display_title: 'Body filter page Paris' + position: 1 + display_options: + field_langcode: '***LANGUAGE_language_content***' + field_langcode_add_to_query: null + path: test-body-paris + display_description: '' + title: 'Test body filters' + defaults: + title: false + filters: false + filter_groups: false + filters: + body_value: + id: body_value + table: block_content__body + field: body_value + relationship: none + group_type: group + admin_label: '' + operator: contains + value: Paris + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + plugin_id: string + entity_type: block_content + entity_field: body + filter_groups: + operator: AND + groups: + 1: AND + display_extenders: { } + page_if: + display_plugin: page + id: page_if + display_title: 'Info filter page' + position: 1 + display_options: + field_langcode: '***LANGUAGE_language_content***' + field_langcode_add_to_query: null + path: test-info-filter + display_description: '' + title: 'Test info filter' + defaults: + title: false + filters: false + filter_groups: false + filters: + info: + id: info + table: block_content_field_data + field: info + relationship: none + group_type: group + admin_label: '' + operator: contains + value: Comida + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + plugin_id: string + entity_type: block_content + entity_field: info + filter_groups: + operator: AND + groups: + 1: AND + display_extenders: { } + page_ifp: + display_plugin: page + id: page_ifp + display_title: 'Info filter page Paris' + position: 1 + display_options: + field_langcode: '***LANGUAGE_language_content***' + field_langcode_add_to_query: null + path: test-info-paris + display_description: '' + title: 'Test info filter' + defaults: + title: false + display_extenders: { } diff --git a/core/modules/block_content/tests/modules/block_content_test_views/test_views/views.view.test_field_type.yml b/core/modules/block_content/tests/modules/block_content_test_views/test_views/views.view.test_field_type.yml new file mode 100644 index 0000000..674cf7f --- /dev/null +++ b/core/modules/block_content/tests/modules/block_content_test_views/test_views/views.view.test_field_type.yml @@ -0,0 +1,30 @@ +langcode: und +status: true +dependencies: + module: + - block_content +id: test_field_type +label: '' +module: views +description: '' +tag: '' +base_table: block_content +base_field: id +core: '8' +display: + default: + display_options: + fields: + type: + field: type + id: type + table: block_content_field_data + plugin_id: block_content_type + entity_type: block_content + entity_field: type + field_langcode: '***LANGUAGE_language_content***' + field_langcode_add_to_query: null + display_plugin: default + display_title: Master + id: default + position: 0