diff --git a/core/config/schema/core.entity.schema.yml b/core/config/schema/core.entity.schema.yml index 9e8ecd3a0adebbd10ca3cb7faa517f4f736978fe..90813e52907745ebf73e2dbabb481ec6251a14f1 100644 --- a/core/config/schema/core.entity.schema.yml +++ b/core/config/schema/core.entity.schema.yml @@ -241,6 +241,19 @@ field.formatter.settings.boolean: type: string label: 'Custom output for TRUE' +field.formatter.settings.boolean: + type: mapping + mapping: + format: + type: string + label: 'Output format' + format_custom_false: + type: string + label: 'Custom output for FALSE' + format_custom_true: + type: string + label: 'Custom output for TRUE' + field.formatter.settings.string: type: mapping mapping: diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php index 56c0ef7a5548f1c2905f2453ed863a16400ff80c..31e537e3a912ab2c5cdf3f4c5ea747b2f49c02cf 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php @@ -25,6 +25,7 @@ * label = @Translation("Plain text"), * field_types = { * "string", + * "uri", * }, * quickedit = { * "editor" = "plain_text" diff --git a/core/modules/action/tests/action_bulk_test/config/install/views.view.test_bulk_form.yml b/core/modules/action/tests/action_bulk_test/config/install/views.view.test_bulk_form.yml index e4180011d1de515c552dfcba1dd6d6b7d52d9096..8fa68aa2335bc8de42dfc2d16a31ef52b0b573f3 100644 --- a/core/modules/action/tests/action_bulk_test/config/install/views.view.test_bulk_form.yml +++ b/core/modules/action/tests/action_bulk_test/config/install/views.view.test_bulk_form.yml @@ -77,8 +77,7 @@ display: html: false hide_empty: false empty_zero: false - link_to_node: true - plugin_id: node + plugin_id: field entity_type: node entity_field: title node_bulk_form: diff --git a/core/modules/aggregator/config/install/views.view.aggregator_rss_feed.yml b/core/modules/aggregator/config/install/views.view.aggregator_rss_feed.yml index a2bdb74fc6cd32e89f013b8d1c3bb0d1a8484cdb..bfc7abf06b2e3ae6c1c3320cb9e03cada7611c44 100644 --- a/core/modules/aggregator/config/install/views.view.aggregator_rss_feed.yml +++ b/core/modules/aggregator/config/install/views.view.aggregator_rss_feed.yml @@ -78,7 +78,7 @@ display: admin_label: '' label: 'Item ID' exclude: false - plugin_id: numeric + plugin_id: field alter: alter_text: false text: '' @@ -118,15 +118,7 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - set_precision: false - precision: 0 - decimal: . - separator: ',' - format_plural: false - format_plural_singular: '1' - format_plural_plural: '@count' - prefix: '' - suffix: '' + type: number_integer entity_type: aggregator_item entity_field: iid filters: { } diff --git a/core/modules/aggregator/config/install/views.view.aggregator_sources.yml b/core/modules/aggregator/config/install/views.view.aggregator_sources.yml index 94558ce32e28434b40aaf475a1ae2779498a7c9a..d615b1447d31e124926ce66219de7c0198444529 100644 --- a/core/modules/aggregator/config/install/views.view.aggregator_sources.yml +++ b/core/modules/aggregator/config/install/views.view.aggregator_sources.yml @@ -77,7 +77,8 @@ display: table: aggregator_feed field: fid id: fid - plugin_id: numeric + plugin_id: field + type: number_integer relationship: none group_type: group admin_label: '' @@ -122,15 +123,6 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - set_precision: false - precision: 0 - decimal: . - separator: ',' - format_plural: false - format_plural_singular: '1' - format_plural_plural: '@count' - prefix: '' - suffix: '' entity_type: aggregator_feed entity_field: fid filters: { } diff --git a/core/modules/aggregator/tests/modules/aggregator_test_views/test_views/views.view.test_aggregator_items.yml b/core/modules/aggregator/tests/modules/aggregator_test_views/test_views/views.view.test_aggregator_items.yml index a04550e3004de6183bd0c177ea4eb3ebcc18c3bc..8e5673f6c5a8035500823146db26fed01d04a251 100644 --- a/core/modules/aggregator/tests/modules/aggregator_test_views/test_views/views.view.test_aggregator_items.yml +++ b/core/modules/aggregator/tests/modules/aggregator_test_views/test_views/views.view.test_aggregator_items.yml @@ -37,7 +37,7 @@ display: table: aggregator_item field: iid id: iid - plugin_id: numeric + plugin_id: field entity_type: aggregator_item entity_field: iid title: diff --git a/core/modules/block_content/src/Tests/Views/RevisionRelationshipsTest.php b/core/modules/block_content/src/Tests/Views/RevisionRelationshipsTest.php index a7ecabefa6a56c8ec60c230d6d46a5d286651c59..828f124e6bfd6a017abadca5dbf5efe91a42684a 100644 --- a/core/modules/block_content/src/Tests/Views/RevisionRelationshipsTest.php +++ b/core/modules/block_content/src/Tests/Views/RevisionRelationshipsTest.php @@ -59,7 +59,7 @@ public function testBlockContentRevisionRelationship() { $block_content_revision->save(); $column_map = array( 'revision_id' => 'revision_id', - 'block_content_revision_id' => 'block_content_revision_id', + 'id_1' => 'id_1', 'block_content_block_content_revision_id' => 'block_content_block_content_revision_id', ); @@ -69,12 +69,12 @@ public function testBlockContentRevisionRelationship() { $resultset_id = array( array( 'revision_id' => '1', - 'block_content_revision_id' => '1', + 'id_1' => '1', 'block_content_block_content_revision_id' => '1', ), array( 'revision_id' => '2', - 'block_content_revision_id' => '1', + 'id_1' => '1', 'block_content_block_content_revision_id' => '1', ), ); @@ -86,7 +86,7 @@ public function testBlockContentRevisionRelationship() { $resultset_revision_id = array( array( 'revision_id' => '2', - 'block_content_revision_id' => '1', + 'id_1' => '1', 'block_content_block_content_revision_id' => '1', ), ); 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 index dcf60593fb6dcd44e1a6113277bb41e0eb2a44f9..4b313f86ca17dba43b9fb7dbf5af1f59393018b7 100644 --- 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 @@ -26,14 +26,14 @@ display: id: revision_id table: block_content_revision field: revision_id - plugin_id: numeric + plugin_id: field entity_type: block_content entity_field: revision_id id_1: id: id_1 table: block_content_revision field: id - plugin_id: standard + plugin_id: field entity_type: block_content entity_field: id id: 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 index 64db56db7a9137255b3b9b3eef6446348972315c..d921c59acd3782b6bbd88918fba4e8a5f8898271 100644 --- 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 @@ -28,14 +28,14 @@ display: id: revision_id table: block_content_revision field: revision_id - plugin_id: standard + plugin_id: field entity_type: block_content entity_field: revision_id id_1: id: id_1 table: block_content_revision field: id - plugin_id: standard + plugin_id: field entity_type: block_content entity_field: id id: diff --git a/core/modules/comment/src/CommentViewsData.php b/core/modules/comment/src/CommentViewsData.php index 7c68bb7f50663ca284e2ca4a2da33f3c6ccaf70b..01e69dab617f32b938588f97ad5944aaf56581d6 100644 --- a/core/modules/comment/src/CommentViewsData.php +++ b/core/modules/comment/src/CommentViewsData.php @@ -102,9 +102,6 @@ public function getViewsData() { $data['comment_field_data']['status']['title'] = t('Approved status'); $data['comment_field_data']['status']['help'] = t('Whether the comment is approved (or still in the moderation queue).'); - $data['comment_field_data']['status']['field']['output formats'] = array( - 'approved-not-approved' => array(t('Approved'), t('Not Approved')), - ); $data['comment_field_data']['status']['filter']['label'] = t('Approved comment status'); $data['comment_field_data']['status']['filter']['type'] = 'yes-no'; diff --git a/core/modules/entity_reference/tests/modules/entity_reference_test/config/install/views.view.test_entity_reference.yml b/core/modules/entity_reference/tests/modules/entity_reference_test/config/install/views.view.test_entity_reference.yml index 2abda30213db12c65d752aef010b23cdc681befe..5b6ba8f81ce697b86133b3f5b7b1a222c1d1decb 100644 --- a/core/modules/entity_reference/tests/modules/entity_reference_test/config/install/views.view.test_entity_reference.yml +++ b/core/modules/entity_reference/tests/modules/entity_reference_test/config/install/views.view.test_entity_reference.yml @@ -84,8 +84,7 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - link_to_node: true - plugin_id: node + plugin_id: field entity_type: node entity_field: title filters: diff --git a/core/modules/entity_reference/tests/modules/entity_reference_test_views/test_views/views.view.test_entity_reference_view.yml b/core/modules/entity_reference/tests/modules/entity_reference_test_views/test_views/views.view.test_entity_reference_view.yml index 2129235479d8510463622bd8eac7f512eb28a753..9452bcb8e2831b7456fca5d7ba06a108ab6ec449 100644 --- a/core/modules/entity_reference/tests/modules/entity_reference_test_views/test_views/views.view.test_entity_reference_view.yml +++ b/core/modules/entity_reference/tests/modules/entity_reference_test_views/test_views/views.view.test_entity_reference_view.yml @@ -23,7 +23,7 @@ display: id: id relationship: none table: entity_test - plugin_id: numeric + plugin_id: field entity_type: entity_test entity_field: id id_1: @@ -31,7 +31,7 @@ display: id: id_1 relationship: test_relationship table: entity_test - plugin_id: numeric + plugin_id: field entity_type: entity_test entity_field: id pager: diff --git a/core/modules/field/config/schema/field.views.schema.yml b/core/modules/field/config/schema/field.views.schema.yml index bdef72e4fdfe5ff0e757ddc2f72967eb441134a3..b1a39cc1fe520856218076af5626b130ceb74d5e 100644 --- a/core/modules/field/config/schema/field.views.schema.yml +++ b/core/modules/field/config/schema/field.views.schema.yml @@ -16,53 +16,6 @@ views.argument.field_list_string: type: boolean label: 'Display list value as human readable' -views.field.field: - type: views_field - label: 'Views entity field handler' - mapping: - click_sort_column: - type: string - label: 'Column used for click sorting' - type: - type: string - label: 'Formatter' - settings: - label: 'Settings' - type: field.formatter.settings.[%parent.type] - group_column: - type: string - label: 'Group by column' - group_columns: - type: sequence - label: 'Group by columns' - sequence: - type: string - label: 'Column' - group_rows: - type: boolean - label: 'Display all values in the same row' - delta_limit: - type: integer - label: 'Field' - delta_offset: - type: integer - label: 'Offset' - delta_reversed: - type: boolean - label: 'Reversed' - delta_first_last: - type: boolean - label: 'First and last only' - multi_type: - type: string - label: 'Display type' - separator: - type: label - label: 'Separator' - field_api_classes: - type: boolean - label: 'Use field template' - views.filter.field_list: type: views.filter.many_to_one label: 'List field' diff --git a/core/modules/field/tests/modules/field_test_views/test_views/views.view.test_view_fieldapi.yml b/core/modules/field/tests/modules/field_test_views/test_views/views.view.test_view_fieldapi.yml index 2c352dd3a84866b36152223e7b7e18fb27c2abaf..2be12755c2a0d1b33340456c9ebb4b62e11580a2 100644 --- a/core/modules/field/tests/modules/field_test_views/test_views/views.view.test_view_fieldapi.yml +++ b/core/modules/field/tests/modules/field_test_views/test_views/views.view.test_view_fieldapi.yml @@ -22,7 +22,7 @@ display: field: nid id: nid table: node - plugin_id: node + plugin_id: field entity_type: node entity_field: nid field_name_0: diff --git a/core/modules/node/config/install/views.view.content.yml b/core/modules/node/config/install/views.view.content.yml index e58eeb4572345f911ecd6b19de26745cb39337f0..a3387bec9ff29450b97bdbe115c8c64035c9431d 100644 --- a/core/modules/node/config/install/views.view.content.yml +++ b/core/modules/node/config/install/views.view.content.yml @@ -168,10 +168,12 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - link_to_node: true - plugin_id: node entity_type: node entity_field: title + type: string + settings: + link_to_entity: true + plugin_id: field type: id: type table: node_field_data @@ -227,11 +229,12 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - type: published-notpublished - type_custom_true: '' - type_custom_false: '' - not: false - plugin_id: boolean + type: boolean + settings: + format: custom + format_custom_true: 'Published' + format_custom_false: 'Unpublished' + plugin_id: field entity_type: node entity_field: status changed: diff --git a/core/modules/node/config/install/views.view.content_recent.yml b/core/modules/node/config/install/views.view.content_recent.yml index 0fb273d5de2bfcc69725207b7bd207be4b787856..c769ff4460f4340432d5c6664c7624c5eddb0234 100644 --- a/core/modules/node/config/install/views.view.content_recent.yml +++ b/core/modules/node/config/install/views.view.content_recent.yml @@ -118,8 +118,6 @@ display: html: false hide_empty: false empty_zero: false - link_to_node: true - plugin_id: node relationship: none group_type: group admin_label: '' @@ -133,6 +131,12 @@ display: element_default_classes: true empty: '' hide_alter_empty: true + type: string + settings: + link_to_entity: true + plugin_id: field + entity_type: node + entity_field: title name: id: name table: users_field_data diff --git a/core/modules/node/config/install/views.view.glossary.yml b/core/modules/node/config/install/views.view.glossary.yml index da43946ae2cefafddd41a7c5902e6d994368b7e3..b0de110076b72e6fccbec706f486d253c43d235d 100644 --- a/core/modules/node/config/install/views.view.glossary.yml +++ b/core/modules/node/config/install/views.view.glossary.yml @@ -68,8 +68,7 @@ display: id: title table: node_field_data field: title - link_to_node: true - plugin_id: node + plugin_id: field relationship: none group_type: group admin_label: '' diff --git a/core/modules/node/src/NodeViewsData.php b/core/modules/node/src/NodeViewsData.php index 79b048122f104424b177249aa22915f95d141d9d..939e51bbbc4c87128e243dee442c9b54427abd9f 100644 --- a/core/modules/node/src/NodeViewsData.php +++ b/core/modules/node/src/NodeViewsData.php @@ -24,7 +24,6 @@ public function getViewsData() { $data['node_field_data']['table']['base']['access query tag'] = 'node_access'; $data['node_field_data']['table']['wizard_id'] = 'node'; - $data['node_field_data']['nid']['field']['id'] = 'node'; $data['node_field_data']['nid']['field']['argument'] = [ 'id' => 'node_nid', 'name field' => 'title', @@ -32,7 +31,8 @@ public function getViewsData() { 'validate type' => 'nid', ]; - $data['node_field_data']['title']['field']['id'] = 'node'; + $data['node_field_data']['title']['field']['default_formatter_settings'] = ['link_to_entity' => TRUE]; + $data['node_field_data']['title']['field']['link_to_node default'] = TRUE; $data['node_field_data']['type']['field']['id'] = 'node_type'; @@ -40,9 +40,6 @@ public function getViewsData() { $data['node_field_data']['langcode']['help'] = t('The language of the content or translation.'); - $data['node_field_data']['status']['field']['output formats'] = [ - 'published-notpublished' => array(t('Published'), t('Not published')), - ]; $data['node_field_data']['status']['filter']['label'] = t('Published status'); $data['node_field_data']['status']['filter']['type'] = 'yes-no'; // Use status = 1 instead of status <> 0 in WHERE statement. @@ -58,15 +55,9 @@ public function getViewsData() { ), ); - $data['node_field_data']['promote']['field']['output formats'] = [ - 'promoted-notpromoted' => array(t('Promoted'), t('Not promoted')), - ]; $data['node_field_data']['promote']['filter']['label'] = t('Promoted to front page status'); $data['node_field_data']['promote']['filter']['type'] = 'yes-no'; - $data['node_field_data']['sticky']['field']['output formats'] = [ - 'sticky' => array(t('Sticky'), t('Not sticky')), - ]; $data['node_field_data']['sticky']['filter']['label'] = t('Sticky status'); $data['node_field_data']['sticky']['filter']['type'] = 'yes-no'; $data['node_field_data']['sticky']['sort']['help'] = t('Whether or not the content is sticky. To list sticky content first, set this to descending.'); @@ -299,9 +290,6 @@ public function getViewsData() { $data['node_field_revision']['table']['join']['node_field_data']['left_field'] = 'vid'; $data['node_field_revision']['table']['join']['node_field_data']['field'] = 'vid'; - $data['node_field_revision']['status']['field']['output formats'] = [ - 'published-notpublished' => [t('Published'), t('Not published')], - ]; $data['node_field_revision']['status']['filter']['label'] = t('Published'); $data['node_field_revision']['status']['filter']['type'] = 'yes-no'; $data['node_field_revision']['status']['filter']['use_equal'] = TRUE; diff --git a/core/modules/node/src/Plugin/views/filter/Status.php b/core/modules/node/src/Plugin/views/filter/Status.php index 9a55860d9a23abcd68af6909675c70c21b476f7d..ccfc58cccd6da670b2e546034c48feee1dc0fb0e 100644 --- a/core/modules/node/src/Plugin/views/filter/Status.php +++ b/core/modules/node/src/Plugin/views/filter/Status.php @@ -36,7 +36,7 @@ public function query() { public function getCacheContexts() { $contexts = parent::getCacheContexts(); - $contexts[] = 'cache.context.user'; + $contexts[] = 'user'; return $contexts; } diff --git a/core/modules/node/src/Plugin/views/wizard/Node.php b/core/modules/node/src/Plugin/views/wizard/Node.php index 829f8523cc196806806bfd8646d8b42046c80376..8271f35a9b4f23c3841d04e43cbe5dd240840e7d 100644 --- a/core/modules/node/src/Plugin/views/wizard/Node.php +++ b/core/modules/node/src/Plugin/views/wizard/Node.php @@ -102,8 +102,8 @@ protected function defaultDisplayOptions() { $display_options['fields']['title']['alter']['html'] = 0; $display_options['fields']['title']['hide_empty'] = 0; $display_options['fields']['title']['empty_zero'] = 0; - $display_options['fields']['title']['link_to_node'] = 1; - $display_options['fields']['title']['plugin_id'] = 'node'; + $display_options['fields']['title']['settings']['link_to_entity'] = 1; + $display_options['fields']['title']['plugin_id'] = 'field'; return $display_options; } @@ -184,8 +184,8 @@ protected function display_options_row(&$display_options, $row_plugin, $row_opt $display_options['fields']['title']['id'] = 'title'; $display_options['fields']['title']['table'] = 'node_field_data'; $display_options['fields']['title']['field'] = 'title'; - $display_options['fields']['title']['link_to_node'] = ($row_plugin == 'titles_linked'); - $display_options['fields']['title']['plugin_id'] = 'node'; + $display_options['fields']['title']['settings']['link_to_entity'] = $row_plugin === 'titles_linked'; + $display_options['fields']['title']['plugin_id'] = 'field'; break; } } diff --git a/core/modules/node/src/Tests/Views/RevisionRelationshipsTest.php b/core/modules/node/src/Tests/Views/RevisionRelationshipsTest.php index e422d6ee5dd86584f9e080d3b5f564320d1fc864..5d33ba230da7b91f4269516184e10ed02b8c89db 100644 --- a/core/modules/node/src/Tests/Views/RevisionRelationshipsTest.php +++ b/core/modules/node/src/Tests/Views/RevisionRelationshipsTest.php @@ -48,8 +48,8 @@ public function testNodeRevisionRelationship() { $node_revision->save(); $column_map = array( 'vid' => 'vid', - 'node_field_revision_nid' => 'node_revision_nid', 'node_field_data_node_field_revision_nid' => 'node_node_revision_nid', + 'nid_1' => 'nid_1', ); // Here should be two rows. @@ -58,13 +58,14 @@ public function testNodeRevisionRelationship() { $resultset_nid = array( array( 'vid' => '1', - 'node_revision_nid' => '1', 'node_node_revision_nid' => '1', + 'nid_1' => '1', ), array( 'vid' => '2', 'node_revision_nid' => '1', 'node_node_revision_nid' => '1', + 'nid_1' => '1', ), ); $this->assertIdenticalResultset($view_nid, $resultset_nid, $column_map); @@ -75,8 +76,8 @@ public function testNodeRevisionRelationship() { $resultset_vid = array( array( 'vid' => '2', - 'node_revision_nid' => '1', 'node_node_revision_nid' => '1', + 'nid_1' => '1', ), ); $this->assertIdenticalResultset($view_vid, $resultset_vid, $column_map); diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_field_filters.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_field_filters.yml index 564867e10e95222f94d78325182d917c69616737..ef618526238e467db7fd839d8e8f1b11d5a1f4ec 100644 --- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_field_filters.yml +++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_field_filters.yml @@ -72,7 +72,6 @@ display: html: false hide_empty: false empty_zero: false - link_to_node: true relationship: none group_type: group admin_label: '' @@ -89,7 +88,7 @@ display: hide_alter_empty: true entity_type: node entity_field: title - plugin_id: node + plugin_id: field filters: status: value: true diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_filter_node_uid_revision.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_filter_node_uid_revision.yml index 8e7264b436b3aaa9a8a184607649dc6f206b18ab..cf6975b35846968d61ea936c024d67945fcea134 100644 --- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_filter_node_uid_revision.yml +++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_filter_node_uid_revision.yml @@ -26,7 +26,7 @@ display: id: nid table: node_field_data field: nid - plugin_id: node + plugin_id: field entity_type: node entity_field: nid filter_groups: diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_language.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_language.yml index 088b003cfb909099cd0fcefcef32257bc0cdabbd..bfa521519d6ff4f10cc9ee260f3308422421e331 100644 --- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_language.yml +++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_language.yml @@ -107,8 +107,7 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - link_to_node: false - plugin_id: node + plugin_id: field entity_type: node entity_field: title langcode: diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_bulk_form.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_bulk_form.yml index 2e41114d5f14e06c937dd3be05fb284a667e4660..f0be1f8278c3591644c13a9a66d78027fd9d4893 100644 --- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_bulk_form.yml +++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_bulk_form.yml @@ -33,7 +33,7 @@ display: id: title table: node_field_data field: title - plugin_id: node + plugin_id: field entity_type: node entity_field: title sorts: diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_revision_nid.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_revision_nid.yml index 8c2c0bfea95dccaf12316bc693d2858dcf92a193..2a3a434578ee395b86601e2ef47872de23f9b336 100644 --- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_revision_nid.yml +++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_revision_nid.yml @@ -20,20 +20,20 @@ display: table: node_field_revision field: nid required: true - plugin_id: standard + plugin_id: field fields: vid: id: vid table: node_field_revision field: vid - plugin_id: standard + plugin_id: field entity_type: node entity_field: vid nid_1: id: nid_1 table: node_field_revision field: nid - plugin_id: standard + plugin_id: field entity_type: node entity_field: nid nid: @@ -41,7 +41,7 @@ display: table: node_field_data field: nid relationship: nid - plugin_id: node + plugin_id: field entity_type: node entity_field: nid arguments: diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_revision_vid.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_revision_vid.yml index 74bdb5ce4d1142059b2f96fbc515f9a02f8b5e83..beabed72bf03e1b44c56f6cc0652835e16b0e81b 100644 --- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_revision_vid.yml +++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_revision_vid.yml @@ -26,14 +26,14 @@ display: id: vid table: node_field_revision field: vid - plugin_id: standard + plugin_id: field entity_type: node entity_field: vid nid_1: id: nid_1 table: node_field_revision field: nid - plugin_id: standard + plugin_id: field entity_type: node entity_field: nid nid: @@ -41,7 +41,7 @@ display: table: node_field_data field: nid relationship: vid - plugin_id: node + plugin_id: field entity_type: node entity_field: nid arguments: diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_view.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_view.yml index 3836f0cf46651cd818f908ea02f07310883967dd..e047e680e4435ef8d3df20b2fe16b20b0d5afe6c 100644 --- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_view.yml +++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_view.yml @@ -118,8 +118,7 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - link_to_node: false - plugin_id: node + plugin_id: field entity_type: node entity_field: nid filters: diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_status_extra.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_status_extra.yml index c3e4cd69f50b89a5360ead6cd689b5d40646b280..96f54939a2429e4b9c0220772bd40d3bc1ef1871 100644 --- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_status_extra.yml +++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_status_extra.yml @@ -82,8 +82,7 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - link_to_node: false - plugin_id: node + plugin_id: field entity_type: node entity_field: title filters: diff --git a/core/modules/options/src/Plugin/views/argument/NumberListField.php b/core/modules/options/src/Plugin/views/argument/NumberListField.php index 9a3f9d3ed30621c742ce39eabc2b4b13108c964d..792381c4c739970cff2d0d39c92db1b74c646f88 100644 --- a/core/modules/options/src/Plugin/views/argument/NumberListField.php +++ b/core/modules/options/src/Plugin/views/argument/NumberListField.php @@ -10,7 +10,7 @@ use Drupal\Component\Utility\String; use Drupal\Core\Field\AllowedTagsXssTrait; use Drupal\Core\Form\FormStateInterface; -use Drupal\field\Views\FieldAPIHandlerTrait; +use Drupal\views\FieldAPIHandlerTrait; use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\display\DisplayPluginBase; use Drupal\views\Plugin\views\argument\Numeric; diff --git a/core/modules/options/src/Plugin/views/argument/StringListField.php b/core/modules/options/src/Plugin/views/argument/StringListField.php index 17189385218dbe63c79fce6bedd154ac5f4e0c31..da715c411f629218c63305b4fcf2f28f4fa0d100 100644 --- a/core/modules/options/src/Plugin/views/argument/StringListField.php +++ b/core/modules/options/src/Plugin/views/argument/StringListField.php @@ -9,7 +9,7 @@ use Drupal\Core\Field\AllowedTagsXssTrait; use Drupal\Core\Form\FormStateInterface; -use Drupal\field\Views\FieldAPIHandlerTrait; +use Drupal\views\FieldAPIHandlerTrait; use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\display\DisplayPluginBase; use Drupal\views\Plugin\views\argument\String; diff --git a/core/modules/options/src/Plugin/views/filter/ListField.php b/core/modules/options/src/Plugin/views/filter/ListField.php index 25fb2901a8cf7f857c0f9c99bd92509069b6d641..f7cad307b266bbb7918a461f53d400305d2f1d68 100644 --- a/core/modules/options/src/Plugin/views/filter/ListField.php +++ b/core/modules/options/src/Plugin/views/filter/ListField.php @@ -7,7 +7,7 @@ namespace Drupal\options\Plugin\views\filter; -use Drupal\field\Views\FieldAPIHandlerTrait; +use Drupal\views\FieldAPIHandlerTrait; use Drupal\views\Plugin\views\display\DisplayPluginBase; use Drupal\views\Plugin\views\filter\ManyToOne; use Drupal\views\ViewExecutable; diff --git a/core/modules/options/tests/options_test_views/test_views/views.view.test_options_list_argument_numeric.yml b/core/modules/options/tests/options_test_views/test_views/views.view.test_options_list_argument_numeric.yml index 5763f70c3b134ab867ec97c96a19cfeb667db0dc..23a2e78391feffe659b118eb4a9efc8411d40326 100644 --- a/core/modules/options/tests/options_test_views/test_views/views.view.test_options_list_argument_numeric.yml +++ b/core/modules/options/tests/options_test_views/test_views/views.view.test_options_list_argument_numeric.yml @@ -72,7 +72,6 @@ display: html: false hide_empty: false empty_zero: false - link_to_node: true relationship: none group_type: group admin_label: '' @@ -87,7 +86,7 @@ display: element_default_classes: true empty: '' hide_alter_empty: true - plugin_id: node + plugin_id: field filters: status: value: true diff --git a/core/modules/options/tests/options_test_views/test_views/views.view.test_options_list_argument_string.yml b/core/modules/options/tests/options_test_views/test_views/views.view.test_options_list_argument_string.yml index 7249f6da11ceefa970e795b132ec16b9210ef53c..7c3b85d0124d19778d7894f1f759d7226244a95e 100644 --- a/core/modules/options/tests/options_test_views/test_views/views.view.test_options_list_argument_string.yml +++ b/core/modules/options/tests/options_test_views/test_views/views.view.test_options_list_argument_string.yml @@ -72,7 +72,6 @@ display: html: false hide_empty: false empty_zero: false - link_to_node: true relationship: none group_type: group admin_label: '' @@ -87,7 +86,7 @@ display: element_default_classes: true empty: '' hide_alter_empty: true - plugin_id: node + plugin_id: field filters: status: value: true diff --git a/core/modules/options/tests/options_test_views/test_views/views.view.test_options_list_filter.yml b/core/modules/options/tests/options_test_views/test_views/views.view.test_options_list_filter.yml index ed6a530f25876f9d673342db8c1b7c53f4168d61..d2dbb92f3536a24c17393418eb1c9ec492b6ec23 100644 --- a/core/modules/options/tests/options_test_views/test_views/views.view.test_options_list_filter.yml +++ b/core/modules/options/tests/options_test_views/test_views/views.view.test_options_list_filter.yml @@ -72,7 +72,6 @@ display: html: false hide_empty: false empty_zero: false - link_to_node: true relationship: none group_type: group admin_label: '' @@ -87,7 +86,7 @@ display: element_default_classes: true empty: '' hide_alter_empty: true - plugin_id: node + plugin_id: field filters: status: value: true diff --git a/core/modules/rest/tests/modules/rest_test_views/test_views/views.view.test_serializer_node_display_field.yml b/core/modules/rest/tests/modules/rest_test_views/test_views/views.view.test_serializer_node_display_field.yml index fee70b98cc90e3cb0c376b39f65b8b95a0902a97..e1687119e8f633a171b21621f8d896745103ff3a 100644 --- a/core/modules/rest/tests/modules/rest_test_views/test_views/views.view.test_serializer_node_display_field.yml +++ b/core/modules/rest/tests/modules/rest_test_views/test_views/views.view.test_serializer_node_display_field.yml @@ -14,7 +14,7 @@ label: 'Test serializer display field rows for entity fields' module: rest_test_views description: '' tag: '' -base_table: node +base_table: node_field_data base_field: nid core: 8.x display: @@ -43,7 +43,7 @@ display: id: nid table: node field: nid - plugin_id: numeric + plugin_id: field entity_type: node entity_field: nid body: diff --git a/core/modules/simpletest/src/AssertContentTrait.php b/core/modules/simpletest/src/AssertContentTrait.php index 42ac01b3114f362d87268c180b3a38cf7788e4b5..9834417b2a89714294c50324e6b599a80ddbc614 100644 --- a/core/modules/simpletest/src/AssertContentTrait.php +++ b/core/modules/simpletest/src/AssertContentTrait.php @@ -238,7 +238,7 @@ protected function xpath($xpath, array $arguments = array()) { * @param string $selector * CSS selector to use in the search. * - * @return \SimpleXMLElement + * @return \SimpleXMLElement[] * The return value of the XPath search performed after converting the CSS * selector to an XPath selector. */ diff --git a/core/modules/statistics/tests/modules/statistics_test_views/test_views/views.view.test_statistics_integration.yml b/core/modules/statistics/tests/modules/statistics_test_views/test_views/views.view.test_statistics_integration.yml index be296577537b23fc50c250f442d573d5c3d78359..e8099fac6295497ed117166bbf8dfb3a0169c56e 100644 --- a/core/modules/statistics/tests/modules/statistics_test_views/test_views/views.view.test_statistics_integration.yml +++ b/core/modules/statistics/tests/modules/statistics_test_views/test_views/views.view.test_statistics_integration.yml @@ -52,8 +52,7 @@ display: html: false hide_empty: false empty_zero: false - link_to_node: true - plugin_id: node + plugin_id: field entity_type: node entity_field: title timestamp: diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php index 3859a02c3feb8c22f87c77805e148920fa9fe2bf..0eff28435b9fb268878f02c9633aaeec00efaaec 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php @@ -23,6 +23,7 @@ * "default" = "Drupal\entity_test\EntityTestForm", * "delete" = "Drupal\entity_test\EntityTestDeleteForm" * }, + * "view_builder" = "Drupal\entity_test\EntityTestViewBuilder", * "translation" = "Drupal\content_translation\ContentTranslationHandler", * "views_data" = "Drupal\views\EntityViewsData" * }, diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml index 7a9a7eef42e3e58ef819f1614160fad46780e693..b32e4526e4a2170f478d90caebddb21c5d09925c 100644 --- a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml +++ b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml @@ -97,7 +97,6 @@ display: html: false hide_empty: false empty_zero: false - link_to_node: true relationship: none group_type: group admin_label: '' @@ -112,7 +111,7 @@ display: element_default_classes: true empty: '' hide_alter_empty: true - plugin_id: node + plugin_id: field entity_type: node entity_field: title filters: diff --git a/core/modules/tracker/src/Tests/Views/TrackerUserUidTest.php b/core/modules/tracker/src/Tests/Views/TrackerUserUidTest.php index 7c9be32f6d846395de4586f07d50137dd9e2a5be..e77d63aac36ac0577c32f1fecfe1552ce00bae19 100644 --- a/core/modules/tracker/src/Tests/Views/TrackerUserUidTest.php +++ b/core/modules/tracker/src/Tests/Views/TrackerUserUidTest.php @@ -29,7 +29,7 @@ class TrackerUserUidTest extends TrackerTestBase { public function testUserUid() { $map = array( 'nid' => 'nid', - 'node_field_data_title' => 'title', + 'title' => 'title', ); $expected = array( diff --git a/core/modules/tracker/tests/modules/tracker_test_views/test_views/views.view.test_tracker_user_uid.yml b/core/modules/tracker/tests/modules/tracker_test_views/test_views/views.view.test_tracker_user_uid.yml index 1b7940b5a9cdd29b109640d6a7b0b22a7e4717e5..7b11ddce1fef04efa216d69acace3f7504ebdfae 100644 --- a/core/modules/tracker/tests/modules/tracker_test_views/test_views/views.view.test_tracker_user_uid.yml +++ b/core/modules/tracker/tests/modules/tracker_test_views/test_views/views.view.test_tracker_user_uid.yml @@ -102,8 +102,7 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - link_to_node: true - plugin_id: node + plugin_id: field entity_type: node entity_field: title filters: diff --git a/core/modules/user/config/install/views.view.user_admin_people.yml b/core/modules/user/config/install/views.view.user_admin_people.yml index f2ea8c304591ece4692c7e60d65f35237873132b..01a48e8c17510077229af3d9d0f8140adb5af2f0 100644 --- a/core/modules/user/config/install/views.view.user_admin_people.yml +++ b/core/modules/user/config/install/views.view.user_admin_people.yml @@ -292,11 +292,12 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - type: active-blocked - type_custom_true: '' - type_custom_false: '' - not: false - plugin_id: boolean + plugin_id: field + type: boolean + settings: + format: custom + format_custom_true: 'Active' + format_custom_false: 'Blocked' entity_type: user entity_field: status roles_target_id: diff --git a/core/modules/user/src/UserViewsData.php b/core/modules/user/src/UserViewsData.php index 00222cba1cabaf3a104f9a28ba7f2360ef6275d9..e043ac14aab92e71618743eac6dfd25aa4b042b7 100644 --- a/core/modules/user/src/UserViewsData.php +++ b/core/modules/user/src/UserViewsData.php @@ -159,9 +159,6 @@ public function getViewsData() { ), ); - $data['users_field_data']['status']['field']['output formats'] = array( - 'active-blocked' => array(t('Active'), t('Blocked')), - ); $data['users_field_data']['status']['filter']['label'] = t('Active'); $data['users_field_data']['status']['filter']['type'] = 'yes-no'; diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_plugin_argument_default_current_user.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_plugin_argument_default_current_user.yml index a67b1fbcc843cc30274c7f249e057546407a14a1..951acb8805fd2cd540b315787d7220a83a21cafe 100644 --- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_plugin_argument_default_current_user.yml +++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_plugin_argument_default_current_user.yml @@ -43,9 +43,8 @@ display: field: title hide_empty: false id: title - link_to_node: false table: node_field_data - plugin_id: node + plugin_id: field entity_type: node entity_field: title pager: diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_relationship.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_relationship.yml index a2207e044269b9509444cb7b91cbf77e2325dee8..f022dd0274839745b388643318eec2e203780c68 100644 --- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_relationship.yml +++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_relationship.yml @@ -64,9 +64,8 @@ display: hide_empty: false id: title label: '' - link_to_node: true table: node_field_data - plugin_id: node + plugin_id: field entity_type: node entity_field: title uid: diff --git a/core/modules/views/config/schema/views.field.schema.yml b/core/modules/views/config/schema/views.field.schema.yml index ba25176d3b28a23f033651c3c659cbbd92d29b09..0d636acf481f44a7e2754863197419564a14280a 100644 --- a/core/modules/views/config/schema/views.field.schema.yml +++ b/core/modules/views/config/schema/views.field.schema.yml @@ -186,3 +186,50 @@ views.field.language: views.field.bulk_form: type: views_field_bulk_form label: 'Bulk form' + +views.field.field: + type: views_field + label: 'Views entity field handler' + mapping: + click_sort_column: + type: string + label: 'Column used for click sorting' + type: + type: string + label: 'Formatter' + settings: + label: 'Settings' + type: field.formatter.settings.[%parent.type] + group_column: + type: string + label: 'Group by column' + group_columns: + type: sequence + label: 'Group by columns' + sequence: + type: string + label: 'Column' + group_rows: + type: boolean + label: 'Display all values in the same row' + delta_limit: + type: integer + label: 'Field' + delta_offset: + type: integer + label: 'Offset' + delta_reversed: + type: boolean + label: 'Reversed' + delta_first_last: + type: boolean + label: 'First and last only' + multi_type: + type: string + label: 'Display type' + separator: + type: label + label: 'Separator' + field_api_classes: + type: boolean + label: 'Use field template' diff --git a/core/modules/views/src/EntityViewsData.php b/core/modules/views/src/EntityViewsData.php index 45bfb04ed29be104195bb5bc1cbc836da0fd4ae6..2f29533baec34f6644eb941276af79ae023beddf 100644 --- a/core/modules/views/src/EntityViewsData.php +++ b/core/modules/views/src/EntityViewsData.php @@ -139,6 +139,7 @@ public function getViewsData() { 'title' => $this->entityType->getLabel(), 'cache_contexts' => $this->entityType->getListCacheContexts(), ]; + $data[$base_table]['table']['entity revision'] = FALSE; if ($label_key = $this->entityType->getKey('label')) { if ($data_table) { @@ -171,6 +172,7 @@ public function getViewsData() { ]; $data[$data_table]['table']['group'] = $this->entityType->getLabel(); $data[$data_table]['table']['provider'] = $this->entityType->getProvider(); + $data[$data_table]['table']['entity revision'] = FALSE; } if ($revision_table) { $data[$revision_table]['table']['group'] = $this->t('@entity_type revision', ['@entity_type' => $this->entityType->getLabel()]); @@ -180,6 +182,7 @@ public function getViewsData() { if ($revision_data_table) { $views_revision_base_table = $revision_data_table; } + $data[$views_revision_base_table]['table']['entity revision'] = TRUE; $data[$views_revision_base_table]['table']['base'] = array( 'field' => $revision_field, 'title' => $this->t('@entity_type revisions', array('@entity_type' => $this->entityType->getLabel())), @@ -193,6 +196,7 @@ public function getViewsData() { if ($revision_data_table) { $data[$revision_data_table]['table']['group'] = $this->t('@entity_type revision', ['@entity_type' => $this->entityType->getLabel()]); + $data[$revision_data_table]['table']['entity revision'] = TRUE; $data[$revision_data_table]['table']['join'][$revision_table] = array( 'left_field' => $revision_field, @@ -326,14 +330,17 @@ protected function mapSingleFieldViewsData($table, $field_name, $field_type, $co break; case 'boolean': - $views_field['field']['id'] = 'boolean'; + $views_field['field']['id'] = 'field'; $views_field['argument']['id'] = 'numeric'; $views_field['filter']['id'] = 'boolean'; $views_field['sort']['id'] = 'standard'; break; case 'uri': - $views_field['field']['id'] = 'url'; + // Let's render URIs as URIs by default, not links. + $views_field['field']['id'] = 'field'; + $views_field['field']['default_formatter'] = 'string'; + $views_field['argument']['id'] = 'string'; $views_field['filter']['id'] = 'string'; $views_field['sort']['id'] = 'standard'; @@ -358,7 +365,7 @@ protected function mapSingleFieldViewsData($table, $field_name, $field_type, $co case 'float': case 'double': case 'decimal': - $views_field['field']['id'] = 'numeric'; + $views_field['field']['id'] = 'field'; $views_field['argument']['id'] = 'numeric'; $views_field['filter']['id'] = 'numeric'; $views_field['sort']['id'] = 'standard'; @@ -371,14 +378,14 @@ protected function mapSingleFieldViewsData($table, $field_name, $field_type, $co case 'text': case 'mediumtext': case 'longtext': - $views_field['field']['id'] = 'standard'; + $views_field['field']['id'] = 'field'; $views_field['argument']['id'] = 'string'; $views_field['filter']['id'] = 'string'; $views_field['sort']['id'] = 'standard'; break; default: - $views_field['field']['id'] = 'standard'; + $views_field['field']['id'] = 'field'; $views_field['argument']['id'] = 'standard'; $views_field['filter']['id'] = 'standard'; $views_field['sort']['id'] = 'standard'; @@ -449,13 +456,13 @@ protected function processViewsDataForEntityReference($table, FieldDefinitionInt 'title' => $entity_type->getLabel(), 'id' => 'standard', ]; - $views_field['field']['id'] = 'numeric'; + $views_field['field']['id'] = 'field'; $views_field['argument']['id'] = 'numeric'; $views_field['filter']['id'] = 'numeric'; $views_field['sort']['id'] = 'standard'; } else { - $views_field['field']['id'] = 'standard'; + $views_field['field']['id'] = 'field'; $views_field['argument']['id'] = 'string'; $views_field['filter']['id'] = 'string'; $views_field['sort']['id'] = 'standard'; @@ -485,7 +492,7 @@ protected function processViewsDataForTextLong($table, FieldDefinitionInterface // Connect the text field to its formatter. if ($field_column_name == 'value') { $views_field['field']['format'] = $field_definition->getName() . '__format'; - $views_field['field']['id'] = 'markup'; + $views_field['field']['id'] = 'field'; } } diff --git a/core/modules/field/src/Views/FieldAPIHandlerTrait.php b/core/modules/views/src/FieldAPIHandlerTrait.php similarity index 96% rename from core/modules/field/src/Views/FieldAPIHandlerTrait.php rename to core/modules/views/src/FieldAPIHandlerTrait.php index da551cb464cd0f58dd04c5eccd13a9acb79087b1..8a7fd120b1d210334f8c172728150c1ec02de2fc 100644 --- a/core/modules/field/src/Views/FieldAPIHandlerTrait.php +++ b/core/modules/views/src/FieldAPIHandlerTrait.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\field\Views\FieldAPIHandlerTrait. + * Contains \Drupal\views\FieldAPIHandlerTrait. */ -namespace Drupal\field\Views; +namespace Drupal\views; use Drupal\Core\Field\BaseFieldDefinition; diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index 1e5d8944df0a72abb664b2d5f0b58d07bec28e69..87bc221894243032e75360b4c31026d6cfc5b53b 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -2610,14 +2610,16 @@ protected function buildRenderingLanguageOptions() { */ protected function isBaseTableTranslatable() { $view_base_table = $this->view->storage->get('base_table'); - foreach (\Drupal::entityManager()->getDefinitions() as $entity_type) { - if ($entity_type->isTranslatable()) { - $base_table = $entity_type->getBaseTable(); - $data_table = $entity_type->getDataTable(); - $revision_table = $entity_type->getRevisionTable(); - $revision_data_table = $entity_type->getRevisionDataTable(); - return in_array($view_base_table, [$base_table, $data_table, $revision_table, $revision_data_table]); - } + $views_data = Views::viewsData()->get($view_base_table); + if (!empty($views_data['table']['entity type'])) { + $entity_type_id = $views_data['table']['entity type']; + $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id); + + $base_table = $entity_type->getBaseTable(); + $data_table = $entity_type->getDataTable(); + $revision_table = $entity_type->getRevisionTable(); + $revision_data_table = $entity_type->getRevisionDataTable(); + return $entity_type->isTranslatable() && in_array($view_base_table, [$base_table, $data_table, $revision_table, $revision_data_table]); } return FALSE; } diff --git a/core/modules/views/src/Plugin/views/field/Field.php b/core/modules/views/src/Plugin/views/field/Field.php index 73e03a4f9069de54edd31aeb4550e8a968e689c4..46d3f5f5e230fe046170a08e7835025abb688b5e 100644 --- a/core/modules/views/src/Plugin/views/field/Field.php +++ b/core/modules/views/src/Plugin/views/field/Field.php @@ -21,7 +21,7 @@ use Drupal\Core\Render\Element; use Drupal\Core\Render\RendererInterface; use Drupal\Core\Session\AccountInterface; -use Drupal\field\Views\FieldAPIHandlerTrait; +use Drupal\views\FieldAPIHandlerTrait; use Drupal\views\Entity\Render\EntityTranslationRenderTrait; use Drupal\views\Plugin\CacheablePluginInterface; use Drupal\views\Plugin\views\display\DisplayPluginBase; @@ -373,9 +373,15 @@ protected function defineOptions() { 'default' => $default_column, ); - $options['type'] = array( - 'default' => isset($field_type['default_formatter']) ? $field_type['default_formatter'] : '', - ); + if (isset($this->definition['default_formatter'])) { + $options['type'] = ['default' => $this->definition['default_formatter']]; + } + elseif (isset($field_type['default_formatter'])) { + $options['type'] = ['default' => $field_type['default_formatter']]; + } + else { + $options['type'] = ['default' => '']; + } $options['settings'] = array( 'default' => isset($this->definition['default_formatter_settings']) ? $this->definition['default_formatter_settings'] : [], @@ -958,7 +964,7 @@ public function getCacheContexts() { // @todo what to do about field access? $contexts = []; - $contexts[] = 'cache.context.user'; + $contexts[] = 'user'; return $contexts; } diff --git a/core/modules/views/src/Plugin/views/filter/Bundle.php b/core/modules/views/src/Plugin/views/filter/Bundle.php index b51835441f9b331aa6702e393dbf96224384a65d..e2e2372d286c147d87ce9760532d08bb2f6252bc 100644 --- a/core/modules/views/src/Plugin/views/filter/Bundle.php +++ b/core/modules/views/src/Plugin/views/filter/Bundle.php @@ -123,8 +123,9 @@ public function calculateDependencies() { $bundle_entity_storage = $this->entityManager->getStorage($bundle_entity_type); foreach (array_keys($this->value) as $bundle) { - $bundle_entity = $bundle_entity_storage->load($bundle); - $dependencies[$bundle_entity->getConfigDependencyKey()][] = $bundle_entity->getConfigDependencyName(); + if ($bundle_entity = $bundle_entity_storage->load($bundle)) { + $dependencies[$bundle_entity->getConfigDependencyKey()][] = $bundle_entity->getConfigDependencyName(); + } } return $dependencies; diff --git a/core/modules/views/src/Plugin/views/query/QueryPluginBase.php b/core/modules/views/src/Plugin/views/query/QueryPluginBase.php index 59b98fa0e6da20dd62b938a7000e1d521f6561d3..2b2b4a2d1c96528c1481586b12a973c2f34e1195 100644 --- a/core/modules/views/src/Plugin/views/query/QueryPluginBase.php +++ b/core/modules/views/src/Plugin/views/query/QueryPluginBase.php @@ -274,7 +274,7 @@ public function getEntityTableInfo() { 'alias' => $base_table, 'relationship_id' => 'none', 'entity_type' => $base_table_data['table']['entity type'], - 'revision' => FALSE, + 'revision' => $base_table_data['table']['entity revision'], ); // Include the entity provider. @@ -292,7 +292,7 @@ public function getEntityTableInfo() { 'relationship_id' => $relationship_id, 'alias' => $relationship->alias, 'entity_type' => $table_data['table']['entity type'], - 'revision' => FALSE, + 'revision' => $table_data['table']['entity revision'], ); // Include the entity provider. diff --git a/core/modules/views/src/Plugin/views/query/Sql.php b/core/modules/views/src/Plugin/views/query/Sql.php index 1be46f982e14c87eb1841b00912b20ebe4c1cb7f..d39ad46d0a1506045fdae1e0a6379f09c9825474 100644 --- a/core/modules/views/src/Plugin/views/query/Sql.php +++ b/core/modules/views/src/Plugin/views/query/Sql.php @@ -1256,7 +1256,7 @@ public function query($get_count = FALSE) { foreach ($entity_information as $entity_type_id => $info) { $entity_type = \Drupal::entityManager()->getDefinition($info['entity_type']); - $base_field = empty($table['revision']) ? $entity_type->getKey('id') : $entity_type->getKey('revision'); + $base_field = !$info['revision'] ? $entity_type->getKey('id') : $entity_type->getKey('revision'); $this->addField($info['alias'], $base_field, '', $params); } } @@ -1466,8 +1466,11 @@ function execute(ViewExecutable $view) { * If the entity belongs to the base table, then it gets stored in * $result->_entity. Otherwise, it gets stored in * $result->_relationship_entities[$relationship_id]; + * + * @param \Drupal\views\ResultRow[] $results + * The result of the SQL query. */ - function loadEntities(&$results) { + public function loadEntities(&$results) { $entity_information = $this->getEntityTableInfo(); // No entity tables found, nothing else to do here. if (empty($entity_information)) { @@ -1489,7 +1492,7 @@ function loadEntities(&$results) { $relationship_id = $info['relationship_id']; $entity_type = $info['entity_type']; $entity_info = $entity_types[$entity_type]; - $id_key = empty($table['revision']) ? $entity_info->getKey('id') : $entity_info->getKey('revision'); + $id_key = !$info['revision'] ? $entity_info->getKey('id') : $entity_info->getKey('revision'); $id_alias = $this->getFieldAlias($info['alias'], $id_key); foreach ($results as $index => $result) { @@ -1505,7 +1508,7 @@ function loadEntities(&$results) { $flat_ids = iterator_to_array(new \RecursiveIteratorIterator(new \RecursiveArrayIterator($ids)), FALSE); // Drupal core currently has no way to load multiple revisions. Sad. - if (isset($entity_table_info[$entity_type]['revision']) && $entity_table_info[$entity_type]['revision'] == TRUE) { + if (isset($entity_information[$entity_type]['revision']) && $entity_information[$entity_type]['revision'] === TRUE) { $entities = array(); foreach ($flat_ids as $revision_id) { $entity = entity_revision_load($entity_type, $revision_id); diff --git a/core/modules/views/src/Tests/Entity/FieldEntityTranslationTest.php b/core/modules/views/src/Tests/Entity/FieldEntityTranslationTest.php new file mode 100644 index 0000000000000000000000000000000000000000..f83199c8343c2ae9c9bfda63ddb6dad6a1064ef2 --- /dev/null +++ b/core/modules/views/src/Tests/Entity/FieldEntityTranslationTest.php @@ -0,0 +1,188 @@ +<?php + +/** + * @file + * Contains \Drupal\views\Tests\Entity\FieldEntityTranslationTest. + */ + +namespace Drupal\views\Tests\Entity; + +use Drupal\Core\Language\Language; +use Drupal\language\Entity\ConfigurableLanguage; +use Drupal\node\Entity\Node; +use Drupal\node\Entity\NodeType; +use Drupal\views\Tests\ViewTestBase; +use Symfony\Component\CssSelector\CssSelector; + +/** + * Tests the rendering of fields (base fields) and their translations. + * + * @group views + */ +class FieldEntityTranslationTest extends ViewTestBase { + + /** + * {@inheritdoc} + */ + public static $modules = ['language', 'locale', 'content_translation', 'node']; + + /** + * {@inheritdoc} + */ + public static $testViews = ['test_entity_field_renderers']; + + /** + * {@inheritdoc} + */ + protected function setUp($import_test_views = TRUE) { + parent::setUp($import_test_views); + + $node_type = NodeType::create([ + 'type' => 'article', + 'label' => 'Article', + ]); + $node_type->save(); + + /** @var \Drupal\content_translation\ContentTranslationManagerInterface $content_translation_manager */ + $content_translation_manager = \Drupal::service('content_translation.manager'); + + $content_translation_manager->setEnabled('node', 'article', 'title'); + $content_translation_manager->setEnabled('node', 'article', 'sticky'); + $content_translation_manager->setEnabled('node', 'article', 'published'); + + $language = ConfigurableLanguage::create([ + 'id' => 'es', + 'label' => 'Spanish', + ]); + $language->save(); + // Rebuild the container to setup the language path processors. + $this->rebuildContainer(); + } + + /** + * Tests that different translation mechanisms can be used for base fields. + */ + public function testTranslationRows() { + $node = Node::create([ + 'type' => 'article', + 'title' => 'example EN', + 'sticky' => false, + ]); + $node->save(); + + $translation = $node->getTranslation('es'); + $translation->title->value = 'example ES'; + $translation->sticky->value = true; + $translation->save(); + + $this->drupalGet('test_entity_field_renderers/entity_translation'); + $this->assertRows( + [ + [ + 'title' => 'example EN', + 'sticky' => 'Off', + ], + [ + 'title' => 'example ES', + 'sticky' => 'On', + ], + ]); + + $this->drupalGet('test_entity_field_renderers/entity_default'); + $this->assertRows( + [ + [ + 'title' => 'example EN', + 'sticky' => 'Off', + ], + [ + 'title' => 'example EN', + 'sticky' => 'Off', + ], + ]); + + $this->drupalGet('test_entity_field_renderers/site_default'); + $this->assertRows( + [ + [ + 'title' => 'example EN', + 'sticky' => 'Off', + ], + [ + 'title' => 'example EN', + 'sticky' => 'Off', + ], + ]); + + $this->drupalGet('test_entity_field_renderers/language_interface'); + $this->assertRows( + [ + [ + 'title' => 'example EN', + 'sticky' => 'Off', + ], + [ + 'title' => 'example EN', + 'sticky' => 'Off', + ], + ]); + + $this->drupalGet('test_entity_field_renderers/language_interface', ['language' => new Language(['id' => 'es'])]); + $this->assertRows( + [ + [ + 'title' => 'example ES', + 'sticky' => 'On', + ], + [ + 'title' => 'example ES', + 'sticky' => 'On', + ], + ]); + + $this->drupalGet('test_entity_field_renderers/en'); + $this->assertRows( + [ + [ + 'title' => 'example EN', + 'sticky' => 'Off', + ], + [ + 'title' => 'example EN', + 'sticky' => 'Off', + ], + ]); + + $this->drupalGet('test_entity_field_renderers/es'); + $this->assertRows( + [ + [ + 'title' => 'example ES', + 'sticky' => 'On', + ], + [ + 'title' => 'example ES', + 'sticky' => 'On', + ], + ]); + } + + /** + * Ensures that the rendered results are working as expected. + * + * @param array $expected + * The expected rows of the result. + */ + protected function assertRows($expected = []) { + $actual = []; + $rows = $this->cssSelect('div.views-row'); + foreach ($rows as $row) { + $actual[] = [ + 'title' => (string) $row->xpath(CssSelector::toXPath('.views-field-title span.field-content a'))[0], + 'sticky' => (string) $row->xpath(CssSelector::toXPath('.views-field-sticky span.field-content'))[0], + ]; + } + $this->assertEqual($actual, $expected); + } + +} diff --git a/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php b/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php index cee903e443ec5f8e257abe42c688d4dc3ab2e9c1..d96f6665d868274b1e6b1d2dcd19560e089d40f2 100644 --- a/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php +++ b/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php @@ -147,6 +147,7 @@ public function testCalculateDependencies() { 'ArgumentValidatorTest' ], 'module' => [ + 'core', 'node', 'search', 'user', @@ -158,7 +159,7 @@ public function testCalculateDependencies() { 'field.storage.node.body' ], 'module' => [ - 'node', + 'core', 'text', 'views' ], diff --git a/core/modules/views/src/Tests/GlossaryTest.php b/core/modules/views/src/Tests/GlossaryTest.php index 36481a451e7998af315683c96c1cb343f892899d..2b0534a7ed4dd4a2befb5d43c7c8e8886560aca0 100644 --- a/core/modules/views/src/Tests/GlossaryTest.php +++ b/core/modules/views/src/Tests/GlossaryTest.php @@ -86,7 +86,7 @@ public function testGlossaryView() { // Verify cache tags. $this->enablePageCaching(); - $this->assertPageCacheContextsAndTags(Url::fromRoute('view.glossary.page_1'), ['cache.context.url', 'node_view_grants', 'language'], [ + $this->assertPageCacheContextsAndTags(Url::fromRoute('view.glossary.page_1'), ['cache.context.url', 'node_view_grants', 'language', 'user'], [ 'config:views.view.glossary', 'node:' . $nodes_by_char['a'][0]->id(), 'node:' . $nodes_by_char['a'][1]->id(), 'node:' . $nodes_by_char['a'][2]->id(), 'node_list', diff --git a/core/modules/views/src/Tests/Handler/FieldFieldTest.php b/core/modules/views/src/Tests/Handler/FieldFieldTest.php index 75f3878c1b3d285d4ae0a1ac25d4bc321ee60f32..4982cdd97a06ed2ed463c34f0a60ed38dda942ba 100644 --- a/core/modules/views/src/Tests/Handler/FieldFieldTest.php +++ b/core/modules/views/src/Tests/Handler/FieldFieldTest.php @@ -8,6 +8,7 @@ namespace Drupal\views\Tests\Handler; use Drupal\entity_test\Entity\EntityTest; +use Drupal\entity_test\Entity\EntityTestRev; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; use Drupal\views\Plugin\views\field\Field; @@ -30,7 +31,7 @@ class FieldFieldTest extends ViewUnitTestBase { /** * {@inheritdoc} */ - public static $testViews = ['test_field_field_test']; + public static $testViews = ['test_field_field_test', 'test_field_field_revision_test']; /** * The stored test entities. @@ -39,6 +40,13 @@ class FieldFieldTest extends ViewUnitTestBase { */ protected $entities; + /** + * The stored revisionable test entities. + * + * @var \Drupal\entity_test\Entity\EntityTestRev[] + */ + protected $entityRevision; + /** * {@inheritdoc} */ @@ -46,6 +54,7 @@ protected function setUp() { parent::setUp(); $this->installEntitySchema('entity_test'); + $this->installEntitySchema('entity_test_rev'); // Setup a field storage and field, but also change the views data for the // entity_test entity type. @@ -72,6 +81,49 @@ protected function setUp() { $entity->save(); } + // Setup some test data for entities with revisions. + // We are testing both base field revisions and field config revisions. + $field_storage = FieldStorageConfig::create([ + 'field_name' => 'field_test', + 'type' => 'integer', + 'entity_type' => 'entity_test_rev', + ]); + $field_storage->save(); + + $field = FieldConfig::create([ + 'field_name' => 'field_test', + 'entity_type' => 'entity_test_rev', + 'bundle' => 'entity_test_rev', + ]); + $field->save(); + + $this->entityRevision = []; + $this->entityRevision[0] = $entity = EntityTestRev::create([ + 'name' => 'base value', + 'field_test' => 1, + ]); + $entity->save(); + + $entity = clone $entity; + $entity->setNewRevision(TRUE); + $entity->name->value = 'revision value1'; + $entity->field_test->value = 2; + $entity->save(); + $this->entityRevision[1] = $entity; + + $entity = clone $entity; + $entity->setNewRevision(TRUE); + $entity->name->value = 'revision value2'; + $entity->field_test->value = 3; + $entity->save(); + $this->entityRevision[2] = $entity; + + $this->entityRevision[0] = $entity = EntityTestRev::create([ + 'name' => 'next entity value', + 'field_test' => 4, + ]); + $entity->save(); + \Drupal::state()->set('entity_test.views_data', [ 'entity_test' => [ 'id' => [ @@ -80,6 +132,13 @@ protected function setUp() { ], ], ], + 'entity_test_rev_revision' => [ + 'id' => [ + 'field' => [ + 'id' => 'field', + ], + ], + ], ]); Views::viewsData()->clear(); @@ -95,13 +154,14 @@ public function testSimpleExecute() { $this->assertTrue($executable->field['id'] instanceof Field); $this->assertTrue($executable->field['field_test'] instanceof Field); - $this->assertIdenticalResultset($executable, [ - ['id' => 1, 'field_test' => 3], - ['id' => 2, 'field_test' => 0], - ['id' => 3, 'field_test' => 8], - ['id' => 4, 'field_test' => 5], - ['id' => 5, 'field_test' => 6], - ], + $this->assertIdenticalResultset($executable, + [ + ['id' => 1, 'field_test' => 3], + ['id' => 2, 'field_test' => 0], + ['id' => 3, 'field_test' => 8], + ['id' => 4, 'field_test' => 5], + ['id' => 5, 'field_test' => 6], + ], ['id' => 'id', 'field_test' => 'field_test'] ); } @@ -125,4 +185,54 @@ public function testSimpleRender() { $this->assertEqual(6, $executable->getStyle()->getField(4, 'field_test')); } + /** + * Tests the revision result. + */ + public function testRevisionExecute() { + $executable = Views::getView('test_field_field_revision_test'); + $executable->execute(); + + $this->assertTrue($executable->field['name'] instanceof Field); + $this->assertTrue($executable->field['field_test'] instanceof Field); + + $this->assertIdenticalResultset($executable, + [ + ['id' => 1, 'field_test' => 1, 'revision_id' => 1, 'name' => 'base value'], + ['id' => 1, 'field_test' => 2, 'revision_id' => 2, 'name' => 'revision value1'], + ['id' => 1, 'field_test' => 3, 'revision_id' => 3, 'name' => 'revision value2'], + ['id' => 2, 'field_test' => 4, 'revision_id' => 4, 'name' => 'next entity value'], + ], + ['entity_test_rev_revision_id' => 'id', 'revision_id' => 'revision_id', 'name' => 'name', 'field_test' => 'field_test'] + ); + } + + /** + * Tests the output of a revision view with base fields and configurable fields. + */ + public function testRevisionRender() { + $executable = Views::getView('test_field_field_revision_test'); + $executable->execute(); + + $this->assertEqual(1, $executable->getStyle()->getField(0, 'id')); + $this->assertEqual(1, $executable->getStyle()->getField(0, 'revision_id')); + $this->assertEqual(1, $executable->getStyle()->getField(0, 'field_test')); + $this->assertEqual('base value', $executable->getStyle()->getField(0, 'name')); + + $this->assertEqual(1, $executable->getStyle()->getField(1, 'id')); + $this->assertEqual(2, $executable->getStyle()->getField(1, 'revision_id')); + $this->assertEqual(2, $executable->getStyle()->getField(1, 'field_test')); + $this->assertEqual('revision value1', $executable->getStyle()->getField(1, 'name')); + + $this->assertEqual(1, $executable->getStyle()->getField(2, 'id')); + $this->assertEqual(3, $executable->getStyle()->getField(2, 'revision_id')); + $this->assertEqual(3, $executable->getStyle()->getField(2, 'field_test')); + $this->assertEqual('revision value2', $executable->getStyle()->getField(2, 'name')); + + $this->assertEqual(2, $executable->getStyle()->getField(3, 'id')); + $this->assertEqual(4, $executable->getStyle()->getField(3, 'revision_id')); + $this->assertEqual(4, $executable->getStyle()->getField(3, 'field_test')); + $this->assertEqual('next entity value', $executable->getStyle()->getField(3, 'name')); + + } + } diff --git a/core/modules/views/src/Tests/Handler/FieldGroupRowsWebTest.php b/core/modules/views/src/Tests/Handler/FieldGroupRowsWebTest.php new file mode 100644 index 0000000000000000000000000000000000000000..39609340e6cc8e58a14a0c07497047a82342016a --- /dev/null +++ b/core/modules/views/src/Tests/Handler/FieldGroupRowsWebTest.php @@ -0,0 +1,124 @@ +<?php + +/** + * @file + * Contains \Drupal\views\Tests\Handler\GroupRowsTest. + */ + +namespace Drupal\views\Tests\Handler; + +use Drupal\Core\Field\FieldStorageDefinitionInterface; +use Drupal\field\Entity\FieldConfig; +use Drupal\field\Entity\FieldStorageConfig; +use Drupal\views\Tests\ViewTestBase; + +/** + * Tests the "Display all values in the same row" setting. + * + * @group views + */ +class FieldGroupRowsWebTest extends ViewTestBase { + + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = ['test_group_rows', 'test_ungroup_rows']; + + /** + * Modules to enable. + * + * @var array + */ + public static $modules = ['node']; + + /** + * The page node type. + * + * @var \Drupal\node\NodeTypeInterface + */ + protected $nodeType; + + /** + * The used field name in the test. + * + * @var string + */ + protected $fieldName; + + /** + * The field storage. + * + * @var \Drupal\field\Entity\FieldStorageConfig + */ + protected $fieldStorage; + + /** + * The field config. + * + * @var \Drupal\field\Entity\FieldConfig + */ + protected $field; + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + + // Create content type with unlimited text field. + $this->nodeType = $this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']); + + // Create the unlimited text field. + $this->fieldName = 'field_views_testing_group_rows'; + $this->fieldStorage = FieldStorageConfig::create([ + 'field_name' => $this->fieldName, + 'entity_type' => 'node', + 'type' => 'text', + 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, + ]); + $this->fieldStorage->save(); + + // Create an instance of the text field on the content type. + $this->field = FieldConfig::create([ + 'field_storage' => $this->fieldStorage, + 'bundle' => $this->nodeType->id(), + ]); + $this->field->save(); + + $edit = [ + 'title' => $this->randomMachineName(), + $this->fieldName => ['a', 'b', 'c'], + ]; + $this->drupalCreateNode($edit); + } + + /** + * Testing when "Display all values in the same row" is checked. + */ + public function testGroupRows() { + $this->drupalGet('test-group-rows'); + $result = $this->cssSelect('div.views-field-field-views-testing-group- div'); + + $rendered_value = []; + foreach ($result as $row) { + $rendered_value[] = (string) $row[0]; + } + $this->assertEqual(['a, b, c'], $rendered_value); + } + + /** + * Testing when "Display all values in the same row" is unchecked. + */ + public function testUngroupedRows() { + $this->drupalGet('test-ungroup-rows'); + $result = $this->cssSelect('div.views-field-field-views-testing-group- div'); + $rendered_value = []; + foreach ($result as $row) { + $rendered_value[] = (string) $row[0]; + } + $this->assertEqual(['a', 'b', 'c'], $rendered_value); + } + +} diff --git a/core/modules/views/src/Tests/ModuleTest.php b/core/modules/views/src/Tests/ModuleTest.php index 1f52a1946ca3efbc89e709e60a892f2791679c11..e801a09f4806f81b30daa8a7f52c1c84898c069e 100644 --- a/core/modules/views/src/Tests/ModuleTest.php +++ b/core/modules/views/src/Tests/ModuleTest.php @@ -30,7 +30,7 @@ class ModuleTest extends ViewUnitTestBase { * * @var array */ - public static $modules = array('user', 'block'); + public static $modules = ['field', 'user', 'block']; /** * Stores the last triggered error, for example via debug(). @@ -142,8 +142,8 @@ public function customErrorHandler($error_level, $message, $filename, $line, $co * Tests the load wrapper/helper functions. */ public function testLoadFunctions() { - $this->enableModules(array('node')); - $this->installConfig(array('node')); + $this->enableModules(['text', 'node']); + $this->installConfig(['node']); $storage = $this->container->get('entity.manager')->getStorage('view'); // Test views_view_is_enabled/disabled. diff --git a/core/modules/views/src/Tests/Plugin/BlockDependenciesTest.php b/core/modules/views/src/Tests/Plugin/BlockDependenciesTest.php index 37c71e78c1c363037f0238567f77818a710bce44..b1f34e6499da9713aafa4048aecf3a3492a174b4 100644 --- a/core/modules/views/src/Tests/Plugin/BlockDependenciesTest.php +++ b/core/modules/views/src/Tests/Plugin/BlockDependenciesTest.php @@ -28,7 +28,7 @@ class BlockDependenciesTest extends ViewUnitTestBase { * * @var array */ - public static $modules = array('node', 'block', 'user'); + public static $modules = array('node', 'block', 'user', 'field'); /** * Tests that exposed filter blocks have the correct dependencies. diff --git a/core/modules/views/src/Tests/RenderCacheIntegrationTest.php b/core/modules/views/src/Tests/RenderCacheIntegrationTest.php index e140668a5d7c96a9762a1220feff6778f0513bbc..da94ab4b8ca59af7edb953fcd39e673904841d01 100644 --- a/core/modules/views/src/Tests/RenderCacheIntegrationTest.php +++ b/core/modules/views/src/Tests/RenderCacheIntegrationTest.php @@ -221,7 +221,7 @@ public function testViewAddCacheMetadata() { $view = View::load('test_display'); $view->save(); - $this->assertEqual(['node_view_grants', 'language'], $view->getDisplay('default')['cache_metadata']['contexts']); + $this->assertEqual(['node_view_grants', 'user', 'language'], $view->getDisplay('default')['cache_metadata']['contexts']); } } diff --git a/core/modules/views/src/Tests/ViewResultAssertionTrait.php b/core/modules/views/src/Tests/ViewResultAssertionTrait.php index 4f730ca3172106938aafa029646a56e5381e6961..222bf254ce19c8c33c5f1b10b056d115fcfb1777 100644 --- a/core/modules/views/src/Tests/ViewResultAssertionTrait.php +++ b/core/modules/views/src/Tests/ViewResultAssertionTrait.php @@ -98,7 +98,7 @@ protected function assertIdenticalResultsetHelper($view, $expected_result, $colu // For entity fields we don't have the raw value. Let's try to fetch it // using the entity itself. elseif (empty($value->$view_column) && isset($view->field[$expected_column]) && ($field = $view->field[$expected_column]) && $field instanceof Field) { - $row[$expected_column] = $field->getEntity($value)->{$field->definition['field_name']}->value; + $row[$expected_column] = $field->getValue($value); } } $result[$key] = $row; diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_aggregate_count.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_aggregate_count.yml index 502cdc165270993edf87e3cc86552bfe42aad5c4..1f922bf86c162a68e7d15a93e567e6fabc1b0811 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_aggregate_count.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_aggregate_count.yml @@ -45,7 +45,8 @@ display: hide_empty: false id: id table: entity_test - plugin_id: numeric + plugin_id: field + type: number_integer entity_type: entity_test entity_field: id group_by: true diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_default_current_user.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_default_current_user.yml index 2e774d1f2925a61fad34b4aaf7e14306bc55b128..cd29ed31113ac61447604bd7224ace47eaac850e 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_default_current_user.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_default_current_user.yml @@ -43,9 +43,8 @@ display: field: title hide_empty: false id: title - link_to_node: false table: node_field_data - plugin_id: node + plugin_id: field entity_type: node entity_field: title pager: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_default_fixed.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_default_fixed.yml index 4a32743bc7d5ed650e24cfc8a36a73d15bdbe705..eb32000bf23b60e570a4f68e73d73b22870d9e74 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_default_fixed.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_default_fixed.yml @@ -43,9 +43,8 @@ display: field: title hide_empty: false id: title - link_to_node: false table: node_field_data - plugin_id: node + plugin_id: field entity_type: node entity_field: title pager: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_dependency.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_dependency.yml index 794dac838c8c4b3f9f70747aed7feb557f85b3e8..f406543be26b70429eef96e3b9fe31ff7a57ecd5 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_dependency.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_dependency.yml @@ -98,8 +98,7 @@ display: html: false hide_empty: false empty_zero: false - link_to_node: true - plugin_id: node + plugin_id: field relationship: none group_type: group admin_label: '' @@ -259,8 +258,7 @@ display: html: false hide_empty: false empty_zero: false - link_to_node: true - plugin_id: node + plugin_id: field relationship: none group_type: group admin_label: '' diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_destroy.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_destroy.yml index 2a39d40fb02e38b10b0011ce0512b187d8c9a78f..7d0af80a7770fedfe9b1ea25d84c860563dec7e8 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_destroy.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_destroy.yml @@ -69,7 +69,7 @@ display: field: nid id: nid table: node_field_data - plugin_id: node + plugin_id: field entity_type: node entity_field: nid path: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_disabled_display.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_disabled_display.yml index 711eefd9a1d5899e4f21678083a75c37905e7a1f..f2c18aa1524bab253d209f60c9ecf49c89890234 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_disabled_display.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_disabled_display.yml @@ -92,8 +92,7 @@ display: html: false hide_empty: false empty_zero: false - link_to_node: true - plugin_id: node + plugin_id: field relationship: none group_type: group admin_label: '' diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display.yml index 2208a662888b4c84e4d3252e1ff84ecb6b80d259..082e7871bbbb5157f49e0f4af55085e9bded190b 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display.yml @@ -26,7 +26,7 @@ display: field: title id: title table: node_field_data - plugin_id: node + plugin_id: field entity_type: node entity_field: title filters: @@ -69,7 +69,6 @@ display: pager: false fields: title: - link_to_node: true plugin_id: node pager: options: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_feed.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_feed.yml index e34e6d89881ca2d7de0b184c5f4f9121baa991a9..0bba63cd00874e8a02909349408950b2069640a4 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_feed.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_feed.yml @@ -37,9 +37,8 @@ display: hide_empty: false id: title label: '' - link_to_node: true table: node_field_data - plugin_id: node + plugin_id: field entity_type: node entity_field: title filters: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_invalid.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_invalid.yml index ad2da8998b9b078aff4b22766e41d7252ce7a72a..88bcf38a4852bab1d321c15a6dbf33024745e7d0 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_invalid.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_invalid.yml @@ -21,7 +21,7 @@ display: id: nid table: node_field_data field: nid - plugin_id: numeric + plugin_id: field entity_type: node entity_field: nid display_plugin: default diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_dropbutton.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_dropbutton.yml index 16e8889b2e244dc9785d16436e5cce80f2de2b55..0d4a0762706219dd6c6da9ae041a8c1df6956444 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_dropbutton.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_dropbutton.yml @@ -40,7 +40,7 @@ display: id: nid table: node_field_data field: nid - plugin_id: node + plugin_id: field relationship: none group_type: group admin_label: '' @@ -85,18 +85,18 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - link_to_node: false entity_type: node entity_field: nid title: id: title table: node_field_data field: title - plugin_id: node + plugin_id: field label: '' alter: alter_text: false - make_link: false + make_link: true + path: node/{{nid}} absolute: false trim: false word_boundary: false @@ -105,7 +105,9 @@ display: html: false hide_empty: false empty_zero: false - link_to_node: true + type: string + settings: + link_to_entity: false entity_type: node entity_field: title nothing: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_field_renderers.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_field_renderers.yml new file mode 100644 index 0000000000000000000000000000000000000000..1572a2fbc24189f1ef200a269a817e3b7bd76dd5 --- /dev/null +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_field_renderers.yml @@ -0,0 +1,102 @@ +langcode: und +status: true +dependencies: + module: + - node +id: test_entity_field_renderers +label: '' +module: views +description: '' +tag: '' +base_table: node_field_data +base_field: nid +core: 8.x +display: + default: + display_plugin: default + id: default + display_title: Master + position: 0 + display_options: + defaults: + fields: false + pager: false + sorts: false + pager: + options: + offset: 0 + type: none + row: + type: 'fields' + sorts: + title: + id: title + table: node_field_data + field: title + plugin_id: standard + entity_type: node + entity_field: title + rendering_language: '***LANGUAGE_entity_translation***' + fields: + title: + id: title + table: node_field_data + field: title + entity_type: node + entity_field: title + plugin_id: field + sticky: + id: sticky + table: node_field_data + field: sticky + entity_type: node + entity_field: sticky + plugin_id: field + page_1: + display_plugin: page + id: page_1 + display_title: Page + position: 1 + display_options: + rendering_language: '***LANGUAGE_entity_translation***' + path: test_entity_field_renderers/entity_translation + page_2: + display_plugin: page + id: page_2 + display_title: Page + position: 2 + display_options: + rendering_language: '***LANGUAGE_entity_default***' + path: test_entity_field_renderers/entity_default + page_3: + display_plugin: page + id: page_3 + display_title: Page + position: 3 + display_options: + rendering_language: '***LANGUAGE_site_default***' + path: test_entity_field_renderers/site_default + page_4: + display_plugin: page + id: page_4 + display_title: Page + position: 4 + display_options: + rendering_language: '***LANGUAGE_language_interface***' + path: test_entity_field_renderers/language_interface + page_5: + display_plugin: page + id: page_5 + display_title: Page + position: 5 + display_options: + rendering_language: 'en' + path: test_entity_field_renderers/en + page_6: + display_plugin: page + id: page_6 + display_title: Page + position: 6 + display_options: + rendering_language: 'es' + path: test_entity_field_renderers/es diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_operations.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_operations.yml index 6a04ecbdad7b1fe16e825196cd7ad0531471781e..d8436d37a84303d6c6f7cf280d80ee29273a2b6d 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_operations.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_operations.yml @@ -85,7 +85,7 @@ display: hide_alter_empty: true entity_type: entity_test entity_field: name - plugin_id: standard + plugin_id: field operations: id: operations table: entity_test diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_type_filter.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_type_filter.yml index ef2e0b3c82cff7e35a230c048e3041a8321fdc9b..fd1764c5559458e696237e0158782979f8c6bad3 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_type_filter.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_type_filter.yml @@ -24,6 +24,7 @@ display: table: node_field_data field: nid relationship: none + plugin_id: field entity_type: node entity_field: nid type: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_field_revision_test.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_field_revision_test.yml new file mode 100644 index 0000000000000000000000000000000000000000..5a49a085c951de79ec218fc0d1860f6ca71f4216 --- /dev/null +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_field_revision_test.yml @@ -0,0 +1,60 @@ +langcode: und +status: true +dependencies: { } +id: test_field_field_revision_test +module: views +description: '' +tag: '' +base_table: entity_test_rev_revision +base_field: id +core: '8' +display: + default: + display_options: + access: + type: none + cache: + type: none + fields: + id: + id: id + table: entity_test_rev_revision + field: id + plugin_id: field + entity_type: entity_test_rev + entity_field: id + revision_id: + id: revision_id + table: entity_test_rev_revision + field: revision_id + plugin_id: field + entity_type: entity_test_rev + entity_field: revision_id + field_test: + id: field_test + table: entity_test__field_test + field: field_test + plugin_id: field + entity_type: entity_test_rev + entity_field: field_test + name: + id: name + table: entity_test_rev_revision + field: name + plugin_id: field + entity_type: entity_test_rev + entity_field: name + sorts: + revision_id: + id: revision_id + table: entity_test_rev_revision + field: revision_id + entity_type: entity_test_rev + entity_field: revision_id + order: ASC + style: + type: html_list + display_plugin: default + display_title: Master + id: default + position: 0 diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_get_entity.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_get_entity.yml index b228a1df5e8386d9cd034a3d5f2ca73fd51c0855..99f38cf8042e4af5fc87fdb2d52eb75fddea61cc 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_get_entity.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_get_entity.yml @@ -35,7 +35,7 @@ display: id: nid table: node_field_data relationship: node - plugin_id: node + plugin_id: field entity_type: node entity_field: nid uid: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_group_override.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_group_override.yml index 1fb95ac5dcf044e88cbe28576cb147144dacb369..0c1fba73d410c968c5c332692b316a591ef5720c 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_group_override.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_group_override.yml @@ -30,7 +30,7 @@ display: id: title label: '' table: node_field_data - plugin_id: node + plugin_id: field entity_type: node entity_field: title filters: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_groups.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_groups.yml index 2e5fa8e9664e33ada60632405898877ce4da3c69..53d216cd1578fe29bc60dea1fa90f61dedb12777 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_groups.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_groups.yml @@ -30,7 +30,7 @@ display: id: title label: '' table: node_field_data - plugin_id: node + plugin_id: field entity_type: node entity_field: title filter_groups: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_get_attach_displays.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_get_attach_displays.yml index 2465cd1b21cf90f5b0860268176f028dc6d0125a..765af4a94a7f1cb049df14274d2f567ff63c5529 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_get_attach_displays.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_get_attach_displays.yml @@ -42,7 +42,7 @@ display: id: title table: node_field_data field: title - plugin_id: node + plugin_id: field label: '' alter: alter_text: false @@ -55,7 +55,6 @@ display: html: false hide_empty: false empty_zero: false - link_to_node: true entity_type: node entity_field: title filters: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_glossary.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_glossary.yml index 7dde87cf464a2343cb5ae92200e47f58ba0f4673..72a99e21f1c5b0e78bae49e2007518a547d15752 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_glossary.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_glossary.yml @@ -43,7 +43,7 @@ display: id: title label: '' table: node_field_data - plugin_id: node + plugin_id: field entity_type: node entity_field: title pager: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_rows.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_rows.yml index 71669ebdb44eb28b3c3a180ef4100567ebaac310..897f20d3c4db788b681b7e8a792e73ab9f82d3ea 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_rows.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_rows.yml @@ -4,6 +4,10 @@ dependencies: module: - field - node + - user + config: + - field.storage.node.field_views_testing_group_rows + module: id: test_group_rows label: test_group_rows module: views @@ -40,6 +44,92 @@ display: id: field_group_rows table: node__field_group_rows field: field_group_rows + hide_empty: false + empty_zero: false + hide_alter_empty: true + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: true + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: true + trim: true + preserve_tags: '' + html: false + title: + id: title + table: node_field_data + field: title + entity_type: node + entity_field: title + plugin_id: field + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: true + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: true + trim: true + preserve_tags: '' + html: false + field_views_testing_group_: + id: field_views_testing_group_rows + table: node__field_views_testing_group_rows + field: field_views_testing_group_rows relationship: none group_type: group admin_label: '' @@ -100,3 +190,11 @@ display: field_api_classes: false plugin_id: field display_extenders: { } + page_1: + display_options: + path: test-group-rows + display_extenders: { } + display_plugin: page + display_title: 'Page display' + id: page_1 + position: 1 diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_handler_relationships.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_handler_relationships.yml index 740f12331edf739220ba82da1176b2e20281c952..21917b8156824423f0a9c88eb81638ec94b922c7 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_handler_relationships.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_handler_relationships.yml @@ -19,7 +19,7 @@ display: id: title table: node_field_data field: title - plugin_id: node + plugin_id: field entity_type: node entity_field: title relationships: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_history.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_history.yml index 7f13a2cc68c0c39e8d16680b5dfacc7c05b540fe..46e536c39592c236ac70f6cadb0e32e913d45086 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_history.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_history.yml @@ -39,7 +39,7 @@ display: id: title table: node_field_data field: title - plugin_id: node + plugin_id: field label: '' alter: alter_text: false @@ -52,7 +52,6 @@ display: html: false hide_empty: false empty_zero: false - link_to_node: true entity_type: node entity_field: title timestamp: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_http_status_code.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_http_status_code.yml index 4600650fedf8f695f75e01fa3fa2b1facd4a5237..053ab75ce1d228956a4c4fbe2156c2143c141147 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_http_status_code.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_http_status_code.yml @@ -49,8 +49,7 @@ display: html: false hide_empty: false empty_zero: false - link_to_node: true - plugin_id: node + plugin_id: field entity_type: node entity_field: title filters: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_mini_pager.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_mini_pager.yml index e82101df38157726997945492cb335c1272a68f1..fcf2f1cd9f8b5f2d34dc518d34aba7303ba3f350 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_mini_pager.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_mini_pager.yml @@ -68,8 +68,7 @@ display: html: false hide_empty: false empty_zero: false - link_to_node: true - plugin_id: node + plugin_id: field entity_type: node entity_field: title filters: { } diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_redirect_view.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_redirect_view.yml index c4c5c6c9cdd5238781b566c116dde93358236caf..500dba1699ee2e8f5d9c5f38fd4f63aca197894c 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_redirect_view.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_redirect_view.yml @@ -54,8 +54,7 @@ display: html: false hide_empty: false empty_zero: false - link_to_node: true - plugin_id: node + plugin_id: field entity_type: node entity_field: title filters: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_search.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_search.yml index 6495dcd1871dd6a4a5af72e32c2c57c1498678a2..91767f9e2457b3d9b746e0b149bb5bab3f3b4759 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_search.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_search.yml @@ -73,7 +73,6 @@ display: html: false hide_empty: false empty_zero: false - link_to_node: true relationship: none group_type: group admin_label: '' @@ -89,9 +88,12 @@ display: element_default_classes: true empty: '' hide_alter_empty: true - plugin_id: node entity_type: node entity_field: title + plugin_id: field + type: string + settings: + link_to_entity: true filters: status: value: true diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_tag_cache.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_tag_cache.yml index 47df910684df635d4caca856db7d5490e08adc19..173547fccca0501d23aed4f104f5afa208903ea9 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_tag_cache.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_tag_cache.yml @@ -36,7 +36,7 @@ display: hide_empty: false id: nid table: node_field_data - plugin_id: numeric + plugin_id: field entity_type: node entity_field: nid title: @@ -53,10 +53,54 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - link_to_node: true - plugin_id: node + plugin_id: field entity_type: node entity_field: title + type: string + settings: + link_to_entity: true + plugin_id: field + filters: + type: + id: type + table: node_field_data + field: type + relationship: none + group_type: group + admin_label: '' + operator: in + value: + page: page + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + reduce: false + 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: bundle + entity_type: node + entity_field: type group_by: true pager: type: some diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_ungroup_rows.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_ungroup_rows.yml new file mode 100644 index 0000000000000000000000000000000000000000..9d203e3373393807afbb704b8c8685e055508123 --- /dev/null +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_ungroup_rows.yml @@ -0,0 +1,120 @@ +langcode: und +status: true +dependencies: + config: + - field.storage.node.field_views_testing_group_rows + module: + - field + - node + - user +id: test_ungroup_rows +label: test_ungroup_rows +module: views +description: '' +tag: '' +base_table: node_field_data +base_field: nid +core: 8.x +display: + default: + display_plugin: default + id: default + display_title: Master + position: 0 + display_options: + access: + type: perm + cache: + type: none + query: + type: views_query + exposed_form: + type: basic + pager: + options: + items_per_page: 10 + type: full + style: + type: default + row: + type: fields + fields: + title: + id: title + table: node_field_data + field: title + entity_type: node + entity_field: title + plugin_id: field + field_views_testing_group_: + id: field_views_testing_group_rows + table: node__field_views_testing_group_rows + field: field_views_testing_group_rows + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: true + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: true + trim: true + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: string + settings: + link_to_entity: false + group_column: value + group_columns: { } + group_rows: false + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + plugin_id: field + display_extenders: { } + page_1: + display_options: + path: test-ungroup-rows + display_extenders: { } + display_plugin: page + display_title: 'Page display' + id: page_1 + position: 1 diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_entity_test.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_entity_test.yml index 03c0a785876c4df199bb20315e953ce20ba1270b..b9dcdfc1bd05163fffac233af752cbab79e8f481 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_entity_test.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_entity_test.yml @@ -35,7 +35,7 @@ display: table: entity_test_update entity_type: entity_test_update entity_field: id - plugin_id: numeric + plugin_id: field name: alter: alter_text: false @@ -50,7 +50,7 @@ display: hide_empty: false id: name table: entity_test_update - plugin_id: standard + plugin_id: field entity_type: entity_test_update entity_field: name pager: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_entity_test_additional_base_field.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_entity_test_additional_base_field.yml index c05cd7df51cae76bfeee9195e0c9274fd2d98b99..8c04154447bbc4a8c0de1ea11d0deffae8735dbc 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_entity_test_additional_base_field.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_entity_test_additional_base_field.yml @@ -35,7 +35,7 @@ display: table: entity_test_update entity_type: entity_test_update entity_field: id - plugin_id: numeric + plugin_id: field new_base_field: alter: alter_text: false @@ -50,7 +50,7 @@ display: hide_empty: false id: new_base_field table: entity_test_update - plugin_id: standard + plugin_id: field entity_type: entity_test_update entity_field: new_base_field pager: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_entity_test_data.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_entity_test_data.yml index 2245c4225fbcb8991be02adc5ca9ec0c2553f986..998bafebd61f687ca73c1856d456d32b4f262685 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_entity_test_data.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_entity_test_data.yml @@ -33,7 +33,7 @@ display: hide_empty: false id: id table: entity_test_update - plugin_id: numeric + plugin_id: field entity_type: entity_test_update entity_field: id name: @@ -50,7 +50,7 @@ display: hide_empty: false id: name table: entity_test_update_data - plugin_id: standard + plugin_id: field entity_type: entity_test_update entity_field: id pager: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_entity_test_revision.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_entity_test_revision.yml index a65b09007fec87eae7303783c7830067e485beb2..23de1360be72dfbe13d71b4cdd89c644d2c606de 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_entity_test_revision.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_entity_test_revision.yml @@ -35,7 +35,7 @@ display: table: entity_test_update_revision entity_type: entity_test_update entity_field: id - plugin_id: numeric + plugin_id: field name: alter: alter_text: false @@ -50,7 +50,7 @@ display: hide_empty: false id: name table: entity_test_update_revision - plugin_id: standard + plugin_id: field entity_type: entity_test_update entity_field: name pager: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_pager_full_zero_items_per_page.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_pager_full_zero_items_per_page.yml index 75f0fd37fd4e47d964305e531ed01bdc26ebf72b..154d61566be17b3743113498667b9d5416511af1 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_pager_full_zero_items_per_page.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_pager_full_zero_items_per_page.yml @@ -34,9 +34,8 @@ display: field: title hide_empty: false id: title - link_to_node: false table: node_field_data - plugin_id: node + plugin_id: field entity_type: node entity_field: title pager: diff --git a/core/modules/views/tests/modules/views_test_language/views_test_language.views.inc b/core/modules/views/tests/modules/views_test_language/views_test_language.views.inc deleted file mode 100644 index b75d1f5ada67fee28a6534349d865a7c1d7a410d..0000000000000000000000000000000000000000 --- a/core/modules/views/tests/modules/views_test_language/views_test_language.views.inc +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -/** - * @file - * Provides views data and hooks for views_test_language module. - */ - -/** - * Implements hook_views_data_alter(). - */ -function views_test_language_views_data_alter(array &$data) { - // Make node titles use configurable field rendering for this test. - // @todo No need for this once https://www.drupal.org/node/2342045 lands. - $data['node_field_data']['title']['field']['id'] = 'field'; -} diff --git a/core/modules/views/tests/src/Unit/EntityViewsDataTest.php b/core/modules/views/tests/src/Unit/EntityViewsDataTest.php index 8e519c442d8f50e599122ddc6d91808d6005c6ef..ee3cb039fe6b7d3a331f72287e8dc347890cd436 100644 --- a/core/modules/views/tests/src/Unit/EntityViewsDataTest.php +++ b/core/modules/views/tests/src/Unit/EntityViewsDataTest.php @@ -161,6 +161,7 @@ public function testBaseTables() { $data = $this->viewsData->getViewsData(); $this->assertEquals('entity_test', $data['entity_test']['table']['entity type']); + $this->assertEquals(FALSE, $data['entity_test']['table']['entity revision']); $this->assertEquals('Entity test', $data['entity_test']['table']['group']); $this->assertEquals('entity_test', $data['entity_test']['table']['provider']); @@ -196,6 +197,7 @@ public function testDataTable() { $this->assertFalse(isset($data['entity_test']['table']['base'])); $this->assertEquals('entity_test_mul', $data['entity_test_mul_property_data']['table']['entity type']); + $this->assertEquals(FALSE, $data['entity_test_mul_property_data']['table']['entity revision']); $this->assertEquals('Entity test', $data['entity_test_mul_property_data']['table']['group']); $this->assertEquals('entity_test', $data['entity_test']['table']['provider']); $this->assertEquals(['field' => 'label', 'table' => 'entity_test_mul_property_data'], $data['entity_test_mul_property_data']['table']['base']['defaults']); @@ -224,7 +226,12 @@ public function testRevisionTableWithoutDataTable() { $this->assertEquals('Entity test revisions', $data['entity_test_mulrev_revision']['table']['base']['title']); $this->assertEquals('revision_id', $data['entity_test_mulrev_revision']['table']['base']['field']); + $this->assertEquals(FALSE, $data['entity_test']['table']['entity revision']); $this->assertEquals('entity_test_mulrev', $data['entity_test_mulrev_revision']['table']['entity type']); + $this->assertEquals(TRUE, $data['entity_test_mulrev_revision']['table']['entity revision']); + $this->assertEquals('entity_test_mulrev', $data['entity_test_mulrev_revision']['table']['entity type']); + $this->assertEquals(TRUE, $data['entity_test_mulrev_revision']['table']['entity revision']); + $this->assertEquals('Entity test revision', $data['entity_test_mulrev_revision']['table']['group']); $this->assertEquals('entity_test', $data['entity_test']['table']['provider']); @@ -711,7 +718,7 @@ protected function assertField($data, $field_name) { * The views data to check. */ protected function assertStringField($data) { - $this->assertEquals('standard', $data['field']['id']); + $this->assertEquals('field', $data['field']['id']); $this->assertEquals('string', $data['filter']['id']); $this->assertEquals('string', $data['argument']['id']); $this->assertEquals('standard', $data['sort']['id']); @@ -724,7 +731,8 @@ protected function assertStringField($data) { * The views data to check. */ protected function assertUriField($data) { - $this->assertEquals('url', $data['field']['id']); + $this->assertEquals('field', $data['field']['id']); + $this->assertEquals('string', $data['field']['default_formatter']); $this->assertEquals('string', $data['filter']['id']); $this->assertEquals('string', $data['argument']['id']); $this->assertEquals('standard', $data['sort']['id']); @@ -740,7 +748,7 @@ protected function assertUriField($data) { */ protected function assertLongTextField($data, $field_name) { $value_field = $data[$field_name . '__value']; - $this->assertEquals('markup', $value_field['field']['id']); + $this->assertEquals('field', $value_field['field']['id']); $this->assertEquals($field_name . '__format', $value_field['field']['format']); $this->assertEquals('string', $value_field['filter']['id']); $this->assertEquals('string', $value_field['argument']['id']); @@ -757,7 +765,7 @@ protected function assertLongTextField($data, $field_name) { */ protected function assertUuidField($data) { // @todo Can we provide additional support for UUIDs in views? - $this->assertEquals('standard', $data['field']['id']); + $this->assertEquals('field', $data['field']['id']); $this->assertEquals('string', $data['filter']['id']); $this->assertEquals('string', $data['argument']['id']); $this->assertEquals('standard', $data['sort']['id']); @@ -770,7 +778,7 @@ protected function assertUuidField($data) { * The views data to check. */ protected function assertNumericField($data) { - $this->assertEquals('numeric', $data['field']['id']); + $this->assertEquals('field', $data['field']['id']); $this->assertEquals('numeric', $data['filter']['id']); $this->assertEquals('numeric', $data['argument']['id']); $this->assertEquals('standard', $data['sort']['id']); @@ -793,7 +801,7 @@ protected function assertLanguageField($data) { * Tests views data for a entity reference field. */ protected function assertEntityReferenceField($data) { - $this->assertEquals('numeric', $data['field']['id']); + $this->assertEquals('field', $data['field']['id']); $this->assertEquals('numeric', $data['filter']['id']); $this->assertEquals('numeric', $data['argument']['id']); $this->assertEquals('standard', $data['sort']['id']); @@ -803,7 +811,7 @@ protected function assertEntityReferenceField($data) { * Tests views data for a bundle field. */ protected function assertBundleField($data) { - $this->assertEquals('standard', $data['field']['id']); + $this->assertEquals('field', $data['field']['id']); $this->assertEquals('bundle', $data['filter']['id']); $this->assertEquals('string', $data['argument']['id']); $this->assertEquals('standard', $data['sort']['id']); diff --git a/core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php b/core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php index b074e999af38ad7700fcdc8b727bcf2d50047c88..9ca73d4642fd50132035cfe890588bed9cafa158 100644 --- a/core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php @@ -140,7 +140,35 @@ public function testDefineOptionsWithNoOptions() { /** * @covers ::defineOptions */ - public function testDefineOptionsWithDefaultFormatter() { + public function testDefineOptionsWithDefaultFormatterOnFieldDefinition() { + $definition = [ + 'entity_type' => 'test_entity', + 'field_name' => 'title', + 'default_formatter' => 'test_example', + 'default_formatter_settings' => ['link_to_entity' => TRUE] + ]; + $handler = new Field([], 'field', $definition, $this->entityManager, $this->formatterPluginManager, $this->fieldTypePluginManager, $this->languageManager, $this->renderer); + + // Setup the entity manager to allow fetching the storage definitions. + $title_storage = $this->getBaseFieldStorage(); + + $this->entityManager->expects($this->atLeastOnce()) + ->method('getFieldStorageDefinitions') + ->with('test_entity') + ->willReturn([ + 'title' => $title_storage, + ]); + + $options = []; + $handler->init($this->executable, $this->display, $options); + + $this->assertEquals('test_example', $handler->options['type']); + } + + /** + * @covers ::defineOptions + */ + public function testDefineOptionsWithDefaultFormatterOnFieldType() { $definition = [ 'entity_type' => 'test_entity', 'field_name' => 'title', @@ -254,7 +282,7 @@ public function testAccess() { $access_control_handler->expects($this->atLeastOnce()) ->method('fieldAccess') - ->with('view', $this->anything(), $account, NULL, FALSE) + ->with('view', $this->anything(), $account, NULL, $this->anything()) ->willReturn(TRUE); $this->assertTrue($handler->access($account)); @@ -265,8 +293,6 @@ public function testAccess() { * * @param string $order * The sort order. - * - * @covers ::clickSort */ public function testClickSortWithOutConfiguredColumn($order) { $definition = [ diff --git a/core/modules/views/views.views.inc b/core/modules/views/views.views.inc index ea865e227119a68997bc50d7277660729379de8c..be4b6e9d6153df3aa4a95594a6f2222e4e0db682 100644 --- a/core/modules/views/views.views.inc +++ b/core/modules/views/views.views.inc @@ -462,7 +462,6 @@ function views_field_default_views_data(FieldStorageConfigInterface $field_stora // Provide a real field for group by. 'real field' => $field_alias . '_' . $real_field, 'additional fields' => $add_fields, - 'entity_tables' => $entity_tables, // Default the element type to div, let the UI change it if necessary. 'element type' => 'div', 'is revision' => $type == EntityStorageInterface::FIELD_LOAD_REVISION, diff --git a/core/modules/views_ui/tests/modules/views_ui_test/config/install/views.view.sa_contrib_2013_035.yml b/core/modules/views_ui/tests/modules/views_ui_test/config/install/views.view.sa_contrib_2013_035.yml index 272a6a2974b8fb845e6fd503e2cd9db77b9326a5..580fdadeaef2f929be9a123d7ea55af5c5dd13b6 100644 --- a/core/modules/views_ui/tests/modules/views_ui_test/config/install/views.view.sa_contrib_2013_035.yml +++ b/core/modules/views_ui/tests/modules/views_ui_test/config/install/views.view.sa_contrib_2013_035.yml @@ -111,8 +111,7 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - link_to_node: true - plugin_id: node + plugin_id: field entity_type: node entity_field: title title_1: @@ -163,8 +162,7 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - link_to_node: true - plugin_id: node + plugin_id: field entity_type: node entity_field: title filters: { }