From 7cd91c92c0ceb16da5e536da38025347646f0422 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Sun, 14 Dec 2014 13:10:29 +0100 Subject: [PATCH] Issue #2349553 by dawehner, pfrenssen, damiankloip: Store entity field information in the views data --- .../install/views.view.test_bulk_form.yml | 7 + .../views.view.aggregator_rss_feed.yml | 2 + .../install/views.view.aggregator_sources.yml | 10 + .../views.view.test_aggregator_items.yml | 10 + .../install/views.view.comments_recent.yml | 12 + .../src/Plugin/views/wizard/Comment.php | 7 + .../views.view.test_comment_row.yml | 6 + .../views.view.test_comment_rss.yml | 2 + .../views.view.test_comment_user_uid.yml | 3 + .../views.view.test_field_filters.yml | 10 + .../views.view.test_contact_link.yml | 5 + ...ews.view.test_entity_translations_link.yml | 6 + .../views.view.test_entity_reference.yml | 6 + .../views.view.test_entity_reference_view.yml | 6 + .../views.view.test_view_fieldapi.yml | 8 + .../file/config/install/views.view.files.yml | 22 ++ .../file/src/Plugin/views/wizard/File.php | 2 + .../config/install/views.view.archive.yml | 8 + .../config/install/views.view.content.yml | 22 ++ .../install/views.view.content_recent.yml | 11 + .../config/install/views.view.frontpage.yml | 11 + .../config/install/views.view.glossary.yml | 12 + .../node/src/Plugin/views/wizard/Node.php | 6 +- .../src/Plugin/views/wizard/NodeRevision.php | 8 +- .../views.view.test_contextual_links.yml | 2 + .../views.view.test_field_filters.yml | 20 ++ .../test_views/views.view.test_field_type.yml | 2 + ...ews.view.test_filter_node_uid_revision.yml | 6 + .../test_views/views.view.test_language.yml | 14 + .../views.view.test_node_bulk_form.yml | 5 + .../views.view.test_node_revision_nid.yml | 8 + .../views.view.test_node_revision_vid.yml | 8 + .../views.view.test_node_row_plugin.yml | 2 + .../test_views/views.view.test_node_view.yml | 8 + .../views.view.test_status_extra.yml | 5 + ...ws.view.test_serializer_display_entity.yml | 2 + ...iew.test_serializer_node_display_field.yml | 4 + ...views.view.test_statistics_integration.yml | 6 + .../install/views.view.taxonomy_term.yml | 2 + .../src/Plugin/views/wizard/TaxonomyTerm.php | 2 + ...ws.view.taxonomy_default_argument_test.yml | 4 + .../views.view.test_field_filters.yml | 14 + ...ws.view.test_filter_taxonomy_index_tid.yml | 4 + .../views.view.test_groupwise_term.yml | 6 + ...iews.view.test_taxonomy_node_term_data.yml | 6 + .../views.view.test_taxonomy_parent.yml | 2 + .../views.view.test_taxonomy_tid_field.yml | 4 + .../views.view.test_tracker_user_uid.yml | 4 + .../install/views.view.user_admin_people.yml | 17 ++ .../config/install/views.view.who_s_new.yml | 8 + .../install/views.view.who_s_online.yml | 8 + .../user/src/Plugin/views/wizard/Users.php | 4 + .../views.view.test_field_permission.yml | 2 + .../views.view.test_filter_permission.yml | 4 + .../views.view.test_groupwise_user.yml | 8 + ...t_plugin_argument_default_current_user.yml | 2 + .../views.view.test_user_bulk_form.yml | 7 + .../views.view.test_user_changed.yml | 4 + .../test_views/views.view.test_user_data.yml | 7 + .../test_views/views.view.test_user_name.yml | 4 + .../views.view.test_user_relationship.yml | 6 + .../views.view.test_user_uid_argument.yml | 4 + ...ews.view.test_views_handler_field_role.yml | 4 + ...iew.test_views_handler_field_user_name.yml | 2 + .../config/schema/views.data_types.schema.yml | 29 +- core/modules/views/src/EntityViewsData.php | 12 +- .../views/src/Plugin/ViewsHandlerManager.php | 2 +- .../Plugin/views/wizard/WizardPluginBase.php | 8 + .../views/src/Tests/ViewExecutableTest.php | 5 - .../views/src/Tests/Wizard/NodeWizardTest.php | 51 ++++ core/modules/views/src/ViewExecutable.php | 25 +- .../views/src/ViewExecutableFactory.php | 14 +- .../views.view.test_aggregate_count.yml | 4 + .../test_views/views.view.test_alias.yml | 3 + ...iew.test_argument_default_current_user.yml | 4 + ...views.view.test_argument_default_fixed.yml | 2 + .../test_views/views.view.test_destroy.yml | 14 + .../test_views/views.view.test_display.yml | 6 + .../views.view.test_display_feed.yml | 6 + .../views.view.test_display_invalid.yml | 2 + .../test_views/views.view.test_dropbutton.yml | 8 + .../views.view.test_entity_row_renderers.yml | 2 + .../views.view.test_entity_type_filter.yml | 6 + .../views.view.test_exposed_admin_ui.yml | 6 + .../views.view.test_exposed_block.yml | 2 + .../views.view.test_exposed_form_buttons.yml | 2 + .../views.view.test_field_get_entity.yml | 8 +- .../views.view.test_filter_date_between.yml | 4 + .../views.view.test_filter_group_override.yml | 4 + .../views.view.test_filter_groups.yml | 16 ++ .../views.view.test_filter_in_operator_ui.yml | 2 + .../views.view.test_get_attach_displays.yml | 8 +- .../test_views/views.view.test_glossary.yml | 4 + .../views.view.test_group_by_count.yml | 4 + .../views.view.test_group_by_in_filters.yml | 4 + .../views.view.test_groupwise_term_ui.yml | 6 + .../views.view.test_handler_relationships.yml | 2 + .../test_views/views.view.test_history.yml | 8 + .../views.view.test_http_status_code.yml | 8 +- .../test_views/views.view.test_mini_pager.yml | 6 +- .../views.view.test_plugin_dependencies.yml | 2 + .../views.view.test_redirect_view.yml | 6 + ...iews.view.test_relationship_dependency.yml | 2 + .../test_views/views.view.test_search.yml | 10 + .../test_views/views.view.test_style_opml.yml | 8 + .../test_views/views.view.test_tag_cache.yml | 6 + ...st_view_pager_full_zero_items_per_page.yml | 2 + .../tests/src/Unit/EntityViewsDataTest.php | 58 +++- .../tests/src/Unit/Plugin/area/ResultTest.php | 5 +- .../src/Unit/Plugin/field/CounterTest.php | 5 +- .../src/Unit/ViewExecutableFactoryTest.php | 12 +- .../tests/src/Unit/ViewExecutableUnitTest.php | 265 ++++++++++++++++-- .../src/Unit/ViewsHandlerManagerTest.php | 129 ++++++++- .../views/tests/src/Unit/ViewsTest.php | 5 +- core/modules/views/views.services.yml | 2 +- .../views.view.sa_contrib_2013_035.yml | 4 + .../tests/src/Unit/ViewListBuilderTest.php | 5 +- 117 files changed, 1183 insertions(+), 73 deletions(-) create mode 100644 core/modules/views/src/Tests/Wizard/NodeWizardTest.php 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 dea2bbaae4dc..c2ae02565c70 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 @@ -79,6 +79,8 @@ display: empty_zero: false link_to_node: true plugin_id: node + entity_type: node + entity_field: title node_bulk_form: id: node_bulk_form table: node @@ -128,6 +130,7 @@ display: empty_zero: false hide_alter_empty: true plugin_id: node_bulk_form + entity_type: node filters: status: value: true @@ -138,6 +141,8 @@ display: operator: '' group: 1 plugin_id: boolean + entity_type: node + entity_field: status sorts: created: id: created @@ -145,6 +150,8 @@ display: field: created order: DESC plugin_id: date + entity_type: node + entity_field: created title: form field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null 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 307e3708fff7..6aeb947142b5 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 @@ -126,6 +126,8 @@ display: format_plural_plural: '@count' prefix: '' suffix: '' + entity_type: aggregator_item + entity_field: iid filters: { } sorts: { } title: 'Aggregator RSS feed' 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 9989e7361a34..8612cffbce7a 100644 --- a/core/modules/aggregator/config/install/views.view.aggregator_sources.yml +++ b/core/modules/aggregator/config/install/views.view.aggregator_sources.yml @@ -131,6 +131,8 @@ display: format_plural_plural: '@count' prefix: '' suffix: '' + entity_type: aggregator_feed + entity_field: fid filters: { } sorts: { } title: Sources @@ -205,6 +207,8 @@ display: hide_alter_empty: true display_as_link: false plugin_id: aggregator_title_link + entity_type: aggregator_feed + entity_field: title url: id: url table: aggregator_feed @@ -255,6 +259,8 @@ display: hide_alter_empty: true display_as_link: false plugin_id: url + entity_type: aggregator_feed + entity_field: url description: id: description table: aggregator_feed @@ -304,6 +310,8 @@ display: empty_zero: false hide_alter_empty: true plugin_id: xss + entity_type: aggregator_feed + entity_field: description link: id: link table: aggregator_feed @@ -354,6 +362,8 @@ display: hide_alter_empty: true display_as_link: false plugin_id: url + entity_type: aggregator_feed + entity_field: link defaults: fields: false title: false 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 6f764cbf05e6..5c094ae62e47 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 @@ -38,6 +38,8 @@ display: field: iid id: iid plugin_id: numeric + entity_type: aggregator_item + entity_field: iid title: table: aggregator_item field: title @@ -70,11 +72,15 @@ display: trim: false preserve_tags: '' html: false + entity_type: aggregator_item + entity_field: title timestamp: table: aggregator_item field: timestamp id: timestamp plugin_id: date + entity_type: aggregator_item + entity_field: timestamp author: table: aggregator_item field: author @@ -107,6 +113,8 @@ display: trim: false preserve_tags: '' html: false + entity_type: aggregator_item + entity_field: author description: id: description table: aggregator_item @@ -156,6 +164,8 @@ display: empty_zero: false hide_alter_empty: true plugin_id: aggregator_xss + entity_type: aggregator_item + entity_field: description filters: { } sorts: { } field_langcode: '***LANGUAGE_language_content***' diff --git a/core/modules/comment/config/install/views.view.comments_recent.yml b/core/modules/comment/config/install/views.view.comments_recent.yml index 73cad152e7b7..41ee8e600c55 100644 --- a/core/modules/comment/config/install/views.view.comments_recent.yml +++ b/core/modules/comment/config/install/views.view.comments_recent.yml @@ -111,6 +111,8 @@ display: hide_alter_empty: true link_to_comment: true link_to_entity: false + entity_type: comment + entity_field: subject changed: id: changed table: comment_field_data @@ -163,6 +165,8 @@ display: date_format: 'time ago' custom_date_format: '' timezone: '' + entity_type: comment + entity_field: changed filters: status: value: true @@ -173,6 +177,8 @@ display: expose: operator: '' group: 1 + entity_type: comment + entity_field: status status_node: value: true table: node_field_data @@ -183,6 +189,8 @@ display: expose: operator: '' group: 1 + entity_type: node + entity_field: status sorts: created: id: created @@ -196,6 +204,8 @@ display: expose: label: '' plugin_id: date + entity_type: comment + entity_field: created cid: id: cid table: comment @@ -208,6 +218,8 @@ display: expose: label: '' plugin_id: standard + entity_type: comment + entity_field: cid title: 'Recent comments' empty: area_text_custom: diff --git a/core/modules/comment/src/Plugin/views/wizard/Comment.php b/core/modules/comment/src/Plugin/views/wizard/Comment.php index fce0bfa29f56..8550825ec0ae 100644 --- a/core/modules/comment/src/Plugin/views/wizard/Comment.php +++ b/core/modules/comment/src/Plugin/views/wizard/Comment.php @@ -39,6 +39,8 @@ class Comment extends WizardPluginBase { 'table' => 'comment_field_data', 'field' => 'status', 'plugin_id' => 'boolean', + 'entity_type' => 'comment', + 'entity_field' => 'status', ), 'status_node' => array( 'value' => TRUE, @@ -46,6 +48,8 @@ class Comment extends WizardPluginBase { 'field' => 'status', 'plugin_id' => 'boolean', 'relationship' => 'node', + 'entity_type' => 'node', + 'entity_field' => 'status', ), ); @@ -72,6 +76,7 @@ class Comment extends WizardPluginBase { $display_options['relationships']['node']['id'] = 'node'; $display_options['relationships']['node']['table'] = 'comment_field_data'; $display_options['relationships']['node']['field'] = 'node'; + $display_options['relationships']['node']['entity_type'] = 'comment_field_data'; $display_options['relationships']['node']['required'] = 1; $display_options['relationships']['node']['plugin_id'] = 'standard'; @@ -82,6 +87,8 @@ class Comment extends WizardPluginBase { $display_options['fields']['subject']['id'] = 'subject'; $display_options['fields']['subject']['table'] = 'comment_field_data'; $display_options['fields']['subject']['field'] = 'subject'; + $display_options['fields']['subject']['entity_type'] = 'comment'; + $display_options['fields']['subject']['entity_field'] = 'subject'; $display_options['fields']['subject']['label'] = ''; $display_options['fields']['subject']['alter']['alter_text'] = 0; $display_options['fields']['subject']['alter']['make_link'] = 0; diff --git a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_row.yml b/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_row.yml index d49daf7f48a8..b92f2d69a610 100644 --- a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_row.yml +++ b/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_row.yml @@ -115,6 +115,8 @@ display: hide_alter_empty: true link_to_entity: false plugin_id: comment + entity_type: comment + entity_field: subject filters: status: value: true @@ -125,6 +127,8 @@ display: operator: '' group: 1 plugin_id: boolean + entity_type: comment + entity_field: status status_node: value: true table: node_field_data @@ -135,6 +139,8 @@ display: operator: '' group: 1 plugin_id: boolean + entity_type: node + entity_field: status sorts: { } title: test_comment_row header: { } diff --git a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_rss.yml b/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_rss.yml index 1a7c75456083..78fccb6c263d 100644 --- a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_rss.yml +++ b/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_rss.yml @@ -59,6 +59,8 @@ display: hide_empty: false empty_zero: false link_to_comment: true + entity_type: comment + entity_field: subject filters: { } sorts: { } field_langcode: '***LANGUAGE_language_content***' diff --git a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_user_uid.yml b/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_user_uid.yml index a60703cc1150..8e852ce6f38b 100644 --- a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_user_uid.yml +++ b/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_user_uid.yml @@ -32,6 +32,7 @@ display: items_per_page: 25 table: node_field_data plugin_id: argument_comment_user_uid + entity_type: node cache: type: none exposed_form: @@ -42,6 +43,8 @@ display: id: nid table: node plugin_id: node + entity_type: node + entity_field: nid pager: type: full query: diff --git a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_field_filters.yml b/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_field_filters.yml index 1ce66e185bfe..ea482481da16 100644 --- a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_field_filters.yml +++ b/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_field_filters.yml @@ -101,6 +101,8 @@ display: hide_alter_empty: true link_to_entity: false plugin_id: comment + entity_type: comment + entity_field: subject filters: subject: id: subject @@ -138,6 +140,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: string + entity_type: comment + entity_field: subject sorts: { } title: 'Title filter page' header: { } @@ -193,6 +197,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: string + entity_type: comment + entity_field: comment_body defaults: filters: false filter_groups: false @@ -249,6 +255,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: string + entity_type: comment + entity_field: comment_body defaults: filters: false filter_groups: false @@ -315,6 +323,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: string + entity_type: comment + entity_field: subject defaults: filters: false filter_groups: false diff --git a/core/modules/contact/tests/modules/contact_test_views/test_views/views.view.test_contact_link.yml b/core/modules/contact/tests/modules/contact_test_views/test_views/views.view.test_contact_link.yml index 7d0bd5e1b819..23ad0d759c68 100644 --- a/core/modules/contact/tests/modules/contact_test_views/test_views/views.view.test_contact_link.yml +++ b/core/modules/contact/tests/modules/contact_test_views/test_views/views.view.test_contact_link.yml @@ -102,12 +102,15 @@ display: anonymous_text: '' format_username: true plugin_id: user_name + entity_type: user + entity_field: name contact: id: contact table: users field: contact plugin_id: contact_link exclude: false + entity_type: user filters: status: value: true @@ -118,6 +121,8 @@ display: operator: '0' group: 1 plugin_id: boolean + entity_type: user + entity_field: status sorts: { } title: test_contact_link header: { } diff --git a/core/modules/content_translation/tests/modules/content_translation_test_views/test_views/views.view.test_entity_translations_link.yml b/core/modules/content_translation/tests/modules/content_translation_test_views/test_views/views.view.test_entity_translations_link.yml index 61e95a49ccee..8b41eb5eb0f8 100644 --- a/core/modules/content_translation/tests/modules/content_translation_test_views/test_views/views.view.test_entity_translations_link.yml +++ b/core/modules/content_translation/tests/modules/content_translation_test_views/test_views/views.view.test_entity_translations_link.yml @@ -53,6 +53,8 @@ display: link_to_user: true format_username: true plugin_id: user_name + entity_type: user + entity_field: name translation_link: id: translation_link table: users @@ -69,6 +71,7 @@ display: hide_alter_empty: true text: Translate plugin_id: content_translation_link + entity_type: user filters: uid_raw: id: uid_raw @@ -80,6 +83,7 @@ display: group: 1 exposed: false plugin_id: numeric + entity_type: user sorts: created: id: created @@ -87,6 +91,8 @@ display: field: created order: DESC plugin_id: date + entity_type: user + entity_field: created title: People empty: area: 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 3046f435f080..3597b6f30e42 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 @@ -86,6 +86,8 @@ display: hide_alter_empty: true link_to_node: true plugin_id: node + entity_type: node + entity_field: title filters: status: value: true @@ -96,6 +98,8 @@ display: operator: '' group: 1 plugin_id: boolean + entity_type: node + entity_field: status sorts: created: id: created @@ -103,6 +107,8 @@ display: field: created order: DESC plugin_id: date + entity_type: node + entity_field: created field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null entity_reference_1: 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 abdda3379453..8b92cb6e3b12 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 @@ -24,12 +24,16 @@ display: relationship: none table: entity_test plugin_id: numeric + entity_type: entity_test + entity_field: id id_1: field: id id: id_1 relationship: test_relationship table: entity_test plugin_id: numeric + entity_type: entity_test + entity_field: id pager: options: offset: 0 @@ -42,6 +46,8 @@ display: relationship: none table: entity_test plugin_id: standard + entity_type: entity_test + entity_field: id relationships: test_relationship: id: field_test 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 6f2bac08f5d4..ed68d092ac64 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 @@ -23,21 +23,29 @@ display: id: nid table: node plugin_id: node + entity_type: node + entity_field: nid field_name_0: id: field_name_0 table: node__field_name_0 field: field_name_0 plugin_id: field + entity_type: node + entity_field: field_name_0 field_name_5: id: field_name_5 table: node__field_name_5 field: field_name_5 plugin_id: field + entity_type: node + entity_field: field_name_5 field_no_view_access: id: field_no_view_access table: node__field_no_view_access field: field_no_view_access plugin_id: field + entity_type: node + entity_field: field_no_view_access cache: type: none exposed_form: diff --git a/core/modules/file/config/install/views.view.files.yml b/core/modules/file/config/install/views.view.files.yml index 185d1427e5eb..711efee2ea33 100644 --- a/core/modules/file/config/install/views.view.files.yml +++ b/core/modules/file/config/install/views.view.files.yml @@ -176,6 +176,8 @@ display: empty: '' hide_alter_empty: true plugin_id: file + entity_type: file + entity_field: fid filename: id: filename table: file_managed @@ -208,6 +210,8 @@ display: empty: '' hide_alter_empty: true plugin_id: file + entity_type: file + entity_field: filename filemime: id: filemime table: file_managed @@ -259,6 +263,8 @@ display: link_to_file: false filemime_image: false plugin_id: file_filemime + entity_type: file + entity_field: filemime filesize: id: filesize table: file_managed @@ -309,6 +315,8 @@ display: hide_alter_empty: true file_size_display: formatted plugin_id: file_size + entity_type: file + entity_field: filesize status: id: status table: file_managed @@ -358,6 +366,8 @@ display: empty_zero: false hide_alter_empty: true plugin_id: file_status + entity_type: file + entity_field: status created: id: created table: file_managed @@ -410,6 +420,8 @@ display: custom_date_format: '' timezone: '' plugin_id: date + entity_type: file + entity_field: created changed: id: changed table: file_managed @@ -462,6 +474,8 @@ display: custom_date_format: '' timezone: '' plugin_id: date + entity_type: file + entity_field: changed count: id: count table: file_usage @@ -559,6 +573,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: string + entity_type: file + entity_field: filename filemime: id: filemime table: file_managed @@ -597,6 +613,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: string + entity_type: file + entity_field: filemime status: id: status table: file_managed @@ -636,6 +654,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: file_status + entity_type: file + entity_field: status sorts: { } title: Files header: { } @@ -979,6 +999,8 @@ display: break_phrase: false not: false plugin_id: file_fid + entity_type: file + entity_field: fid style: type: table options: diff --git a/core/modules/file/src/Plugin/views/wizard/File.php b/core/modules/file/src/Plugin/views/wizard/File.php index 6bd3daa5b28c..36f57ac15c96 100644 --- a/core/modules/file/src/Plugin/views/wizard/File.php +++ b/core/modules/file/src/Plugin/views/wizard/File.php @@ -41,6 +41,8 @@ class File extends WizardPluginBase { $display_options['fields']['filename']['id'] = 'filename'; $display_options['fields']['filename']['table'] = 'file_managed'; $display_options['fields']['filename']['field'] = 'filename'; + $display_options['fields']['filename']['entity_type'] = 'file'; + $display_options['fields']['filename']['entity_field'] = 'filename'; $display_options['fields']['filename']['label'] = ''; $display_options['fields']['filename']['alter']['alter_text'] = 0; $display_options['fields']['filename']['alter']['make_link'] = 0; diff --git a/core/modules/node/config/install/views.view.archive.yml b/core/modules/node/config/install/views.view.archive.yml index eb2f439fefbb..047d0623643a 100644 --- a/core/modules/node/config/install/views.view.archive.yml +++ b/core/modules/node/config/install/views.view.archive.yml @@ -75,6 +75,8 @@ display: expose: label: '' granularity: second + entity_type: node + entity_field: created arguments: created_year_month: id: created_year_month @@ -94,6 +96,7 @@ display: items_per_page: 30 specify_validation: true plugin_id: date_year_month + entity_type: node filters: status: id: status @@ -104,6 +107,8 @@ display: expose: operator: '0' plugin_id: boolean + entity_type: node + entity_field: status langcode: id: langcode table: node_field_data @@ -142,6 +147,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: language + entity_type: node + entity_field: langcode style: type: default options: @@ -188,6 +195,7 @@ display: items_per_page: 30 specify_validation: true plugin_id: date_year_month + entity_type: node field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null page_1: diff --git a/core/modules/node/config/install/views.view.content.yml b/core/modules/node/config/install/views.view.content.yml index 0b1cfc291f1e..2a44101f8dc3 100644 --- a/core/modules/node/config/install/views.view.content.yml +++ b/core/modules/node/config/install/views.view.content.yml @@ -148,6 +148,7 @@ display: empty_zero: false hide_alter_empty: true plugin_id: node_bulk_form + entity_type: node title: id: title table: node_field_data @@ -164,6 +165,8 @@ display: hide_alter_empty: true link_to_node: true plugin_id: node + entity_type: node + entity_field: title type: id: type table: node_field_data @@ -181,6 +184,8 @@ display: link_to_node: false machine_name: '' plugin_id: node_type + entity_type: node + entity_field: type name: id: name table: users_field_data @@ -201,6 +206,8 @@ display: anonymous_text: '' format_username: true plugin_id: user_name + entity_type: user + entity_field: name status: id: status table: node_field_data @@ -220,6 +227,8 @@ display: type_custom_false: '' not: '' plugin_id: boolean + entity_type: node + entity_field: status changed: id: changed table: node_field_data @@ -238,6 +247,8 @@ display: custom_date_format: '' timezone: '' plugin_id: date + entity_type: node + entity_field: changed edit_node: id: edit_node table: node @@ -246,6 +257,7 @@ display: exclude: true text: Edit plugin_id: node_link_edit + entity_type: node delete_node: id: delete_node table: node @@ -254,6 +266,7 @@ display: exclude: true text: Delete plugin_id: node_link_delete + entity_type: node dropbutton: id: dropbutton table: views @@ -273,6 +286,7 @@ display: value: false plugin_id: node_status group: 1 + entity_type: node status: id: status table: node_field_data @@ -317,6 +331,8 @@ display: operator: '=' value: '0' plugin_id: boolean + entity_type: node + entity_field: status type: id: type table: node_field_data @@ -356,6 +372,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: bundle + entity_type: node + entity_field: type title: id: title table: node_field_data @@ -394,6 +412,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: string + entity_type: node + entity_field: title langcode: id: langcode table: node_field_data @@ -433,6 +453,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: language + entity_type: node + entity_field: langcode sorts: { } title: Content empty: 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 87b7a4354553..945643618f89 100644 --- a/core/modules/node/config/install/views.view.content_recent.yml +++ b/core/modules/node/config/install/views.view.content_recent.yml @@ -157,6 +157,8 @@ display: hide_alter_empty: true link_to_node: true plugin_id: node + entity_type: node + entity_field: title name: id: name table: users_field_data @@ -210,6 +212,8 @@ display: anonymous_text: '' format_username: true plugin_id: user_name + entity_type: user + entity_field: name edit_node: id: edit_node table: node @@ -260,6 +264,7 @@ display: hide_alter_empty: true text: edit plugin_id: node_link_edit + entity_type: node delete_node: id: delete_node table: node @@ -310,6 +315,7 @@ display: hide_alter_empty: true text: delete plugin_id: node_link_delete + entity_type: node filters: status_extra: id: status_extra @@ -347,6 +353,7 @@ display: default_group_multiple: { } group_items: { } plugin_id: node_status + entity_type: node langcode: id: langcode table: node_field_data @@ -385,6 +392,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: language + entity_type: node + entity_field: langcode sorts: changed: id: changed @@ -399,6 +408,8 @@ display: label: '' granularity: second plugin_id: date + entity_type: node + entity_field: changed title: 'Recent content' header: { } footer: { } diff --git a/core/modules/node/config/install/views.view.frontpage.yml b/core/modules/node/config/install/views.view.frontpage.yml index 312110bbafdb..b5d02e938db2 100644 --- a/core/modules/node/config/install/views.view.frontpage.yml +++ b/core/modules/node/config/install/views.view.frontpage.yml @@ -45,6 +45,7 @@ display: relationship: none table: node plugin_id: node_listing_empty + entity_type: node title: id: title table: views @@ -103,6 +104,8 @@ display: table: node_field_data value: true plugin_id: boolean + entity_type: node + entity_field: promote status: expose: operator: '' @@ -112,6 +115,8 @@ display: table: node_field_data value: true plugin_id: boolean + entity_type: node + entity_field: status langcode: id: langcode table: node_field_data @@ -150,6 +155,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: language + entity_type: node + entity_field: langcode pager: type: full options: @@ -196,6 +203,8 @@ display: relationship: none table: node_field_data plugin_id: boolean + entity_type: node + entity_field: sticky created: field: created id: created @@ -209,6 +218,8 @@ display: expose: label: '' granularity: second + entity_type: node + entity_field: created style: type: default options: diff --git a/core/modules/node/config/install/views.view.glossary.yml b/core/modules/node/config/install/views.view.glossary.yml index eea6acae15c5..1625bddfa90a 100644 --- a/core/modules/node/config/install/views.view.glossary.yml +++ b/core/modules/node/config/install/views.view.glossary.yml @@ -113,6 +113,8 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true + entity_type: node + entity_field: title name: id: name table: users_field_data @@ -166,6 +168,8 @@ display: overwrite_anonymous: false anonymous_text: '' format_username: true + entity_type: user + entity_field: name changed: id: changed table: node_field_data @@ -218,6 +222,8 @@ display: hide_alter_empty: true custom_date_format: '' timezone: '' + entity_type: node + entity_field: changed arguments: title: id: title @@ -250,6 +256,8 @@ display: fail: 'not found' validate_options: { } break_phrase: false + entity_type: node + entity_field: title relationships: uid: id: uid @@ -339,6 +347,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: language + entity_type: node + entity_field: langcode attachment_1: id: attachment_1 display_title: Attachment @@ -390,6 +400,8 @@ display: fail: 'not found' validate_options: { } break_phrase: false + entity_type: node + entity_field: title displays: default: default page_1: page_1 diff --git a/core/modules/node/src/Plugin/views/wizard/Node.php b/core/modules/node/src/Plugin/views/wizard/Node.php index 05cf100d42b5..b9c66e0c50ca 100644 --- a/core/modules/node/src/Plugin/views/wizard/Node.php +++ b/core/modules/node/src/Plugin/views/wizard/Node.php @@ -38,7 +38,9 @@ class Node extends WizardPluginBase { 'value' => TRUE, 'table' => 'node_field_data', 'field' => 'status', - 'plugin_id' => 'boolean' + 'plugin_id' => 'boolean', + 'entity_type' => 'node', + 'entity_field' => 'status', ) ); @@ -85,6 +87,8 @@ class Node extends WizardPluginBase { $display_options['fields']['title']['id'] = 'title'; $display_options['fields']['title']['table'] = 'node_field_data'; $display_options['fields']['title']['field'] = 'title'; + $display_options['fields']['title']['entity_type'] = 'node'; + $display_options['fields']['title']['entity_field'] = 'title'; $display_options['fields']['title']['label'] = ''; $display_options['fields']['title']['alter']['alter_text'] = 0; $display_options['fields']['title']['alter']['make_link'] = 0; diff --git a/core/modules/node/src/Plugin/views/wizard/NodeRevision.php b/core/modules/node/src/Plugin/views/wizard/NodeRevision.php index 6d68b2b598d9..8c843f6e8c5c 100644 --- a/core/modules/node/src/Plugin/views/wizard/NodeRevision.php +++ b/core/modules/node/src/Plugin/views/wizard/NodeRevision.php @@ -37,7 +37,9 @@ class NodeRevision extends WizardPluginBase { 'value' => TRUE, 'table' => 'node_field_revision', 'field' => 'status', - 'plugin_id' => 'boolean' + 'plugin_id' => 'boolean', + 'entity_type' => 'node', + 'entity_field' => 'status', ) ); @@ -70,6 +72,8 @@ class NodeRevision extends WizardPluginBase { $display_options['fields']['changed']['id'] = 'changed'; $display_options['fields']['changed']['table'] = 'node_field_revision'; $display_options['fields']['changed']['field'] = 'changed'; + $display_options['fields']['changed']['entity_type'] = 'node'; + $display_options['fields']['changed']['entity_field'] = 'changed'; $display_options['fields']['changed']['alter']['alter_text'] = FALSE; $display_options['fields']['changed']['alter']['make_link'] = FALSE; $display_options['fields']['changed']['alter']['absolute'] = FALSE; @@ -86,6 +90,8 @@ class NodeRevision extends WizardPluginBase { $display_options['fields']['title']['id'] = 'title'; $display_options['fields']['title']['table'] = 'node_field_revision'; $display_options['fields']['title']['field'] = 'title'; + $display_options['fields']['title']['entity_type'] = 'node'; + $display_options['fields']['title']['entity_field'] = 'title'; $display_options['fields']['title']['label'] = ''; $display_options['fields']['title']['alter']['alter_text'] = 0; $display_options['fields']['title']['alter']['make_link'] = 0; diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_contextual_links.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_contextual_links.yml index e0f09ae70008..ad1e38f6823e 100644 --- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_contextual_links.yml +++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_contextual_links.yml @@ -86,6 +86,8 @@ display: relationship: none table: node plugin_id: numeric + entity_type: node + entity_field: nid menu: type: tab title: 'Test contextual link' 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 409f16faba13..2c99a305e020 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 @@ -88,6 +88,8 @@ display: element_default_classes: true empty: '' hide_alter_empty: true + entity_type: node + entity_field: title plugin_id: node filters: status: @@ -99,6 +101,8 @@ display: operator: '' group: 1 plugin_id: boolean + entity_type: node + entity_field: status title: id: title table: node_field_data @@ -135,6 +139,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: string + entity_type: node + entity_field: title sorts: created: id: created @@ -149,6 +155,8 @@ display: label: '' granularity: second plugin_id: date + entity_type: node + entity_field: created title: 'Test field filters' header: { } footer: { } @@ -182,6 +190,8 @@ display: operator: '' group: 1 plugin_id: boolean + entity_type: node + entity_field: status body_value: id: body_value table: node__body @@ -218,6 +228,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: string + entity_type: node + entity_field: body filter_groups: operator: AND groups: @@ -246,6 +258,8 @@ display: expose: operator: '' group: 1 + entity_type: node + entity_field: status plugin_id: boolean body_value: id: body_value @@ -283,6 +297,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: string + entity_type: node + entity_field: body filter_groups: operator: AND groups: @@ -311,6 +327,8 @@ display: expose: operator: '' group: 1 + entity_type: node + entity_field: status plugin_id: boolean title: id: title @@ -348,6 +366,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: string + entity_type: node + entity_field: title filter_groups: operator: AND groups: diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_field_type.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_field_type.yml index ef2f7a275328..b2f9b3f9ffbb 100644 --- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_field_type.yml +++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_field_type.yml @@ -20,6 +20,8 @@ display: id: type table: node_field_data plugin_id: node_type + entity_type: node + entity_field: type field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null display_plugin: default 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 1b8130cc3064..8ce5ac0ecd3b 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 @@ -27,6 +27,8 @@ display: table: node field: nid plugin_id: node + entity_type: node + entity_field: nid filter_groups: groups: 1: AND @@ -43,6 +45,8 @@ display: value: - '1' plugin_id: node_uid_revision + entity_type: node + entity_field: uid_revision sorts: nid: id: nid @@ -51,6 +55,8 @@ display: order: ASC plugin_id: standard relationship: none + entity_type: node + entity_field: nid pager: type: full query: 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 cf5894e5139e..462d371b3501 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 @@ -109,6 +109,8 @@ display: hide_alter_empty: true link_to_node: false plugin_id: node + entity_type: node + entity_field: title langcode: id: langcode table: node_field_data @@ -160,6 +162,8 @@ display: link_to_node: false native_language: false plugin_id: node_language + entity_type: node + entity_field: langcode filters: status: value: true @@ -170,6 +174,8 @@ display: operator: '' group: 1 plugin_id: boolean + entity_type: node + entity_field: status type: id: type table: node_field_data @@ -177,6 +183,8 @@ display: value: page: page plugin_id: bundle + entity_type: node + entity_field: type langcode: id: langcode table: node_field_data @@ -216,6 +224,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: language + entity_type: node + entity_field: langcode sorts: langcode: id: langcode @@ -229,6 +239,8 @@ display: expose: label: '' plugin_id: standard + entity_type: node + entity_field: langcode title: 'Language filter test' header: { } footer: { } @@ -268,6 +280,8 @@ display: fail: 'not found' validate_options: { } plugin_id: language + entity_type: node + entity_field: langcode field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null page_1: 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 fdcd84669aeb..f01d13db8bd2 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 @@ -28,11 +28,14 @@ display: table: node field: node_bulk_form plugin_id: node_bulk_form + entity_type: node title: id: title table: node_field_data field: title plugin_id: node + entity_type: node + entity_field: title sorts: nid: id: nid @@ -40,6 +43,8 @@ display: field: nid order: ASC plugin_id: standard + entity_type: node + entity_field: nid field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null page_1: 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 f5f48f1c7089..d9faafd4fce8 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 @@ -27,23 +27,31 @@ display: table: node_revision field: vid plugin_id: standard + entity_type: node + entity_field: vid nid_1: id: nid_1 table: node_revision field: nid plugin_id: standard + entity_type: node + entity_field: nid nid: id: nid table: node field: nid relationship: nid plugin_id: node + entity_type: node + entity_field: nid arguments: nid: id: nid table: node_revision field: nid plugin_id: node_nid + entity_type: node + entity_field: nid field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null display_plugin: default 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 eae9704cd1ce..72e818289f82 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 @@ -27,23 +27,31 @@ display: table: node_revision field: vid plugin_id: standard + entity_type: node + entity_field: vid nid_1: id: nid_1 table: node_revision field: nid plugin_id: standard + entity_type: node + entity_field: nid nid: id: nid table: node field: nid relationship: vid plugin_id: node + entity_type: node + entity_field: nid arguments: nid: id: nid table: node_revision field: nid plugin_id: node_nid + entity_type: node + entity_field: nid field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null display_plugin: default diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_row_plugin.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_row_plugin.yml index 6292f91729a3..0139a99bd9b2 100644 --- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_row_plugin.yml +++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_row_plugin.yml @@ -31,6 +31,8 @@ display: table: node value: true plugin_id: boolean + entity_type: node + entity_field: status pager: options: items_per_page: 10 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 200c997f398d..2302614d34d4 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 @@ -120,6 +120,8 @@ display: hide_alter_empty: true link_to_node: false plugin_id: node + entity_type: node + entity_field: nid filters: status: value: true @@ -130,6 +132,8 @@ display: operator: '' group: 1 plugin_id: boolean + entity_type: node + entity_field: status sorts: created: id: created @@ -144,6 +148,8 @@ display: label: '' granularity: second plugin_id: date + entity_type: node + entity_field: created title: test_node_view header: { } footer: { } @@ -189,6 +195,8 @@ display: transform_dash: false break_phrase: false plugin_id: node_type + entity_type: node + entity_field: type field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null page_1: 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 45356b167627..59b44088411d 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 @@ -84,6 +84,8 @@ display: hide_alter_empty: true link_to_node: false plugin_id: node + entity_type: node + entity_field: title filters: status_extra: id: status_extra @@ -121,6 +123,7 @@ display: default_group_multiple: { } group_items: { } plugin_id: node_status + entity_type: node sorts: nid: id: nid @@ -128,6 +131,8 @@ display: field: nid order: ASC plugin_id: standard + entity_type: node + entity_field: nid filter_groups: operator: AND groups: diff --git a/core/modules/rest/tests/modules/rest_test_views/test_views/views.view.test_serializer_display_entity.yml b/core/modules/rest/tests/modules/rest_test_views/test_views/views.view.test_serializer_display_entity.yml index 82d6a41a6d12..03d3aa610763 100644 --- a/core/modules/rest/tests/modules/rest_test_views/test_views/views.view.test_serializer_display_entity.yml +++ b/core/modules/rest/tests/modules/rest_test_views/test_views/views.view.test_serializer_display_entity.yml @@ -40,6 +40,8 @@ display: field: id order: DESC plugin_id: date + entity_type: entity_test + entity_field: id title: 'Test serialize' arguments: { } field_langcode: '***LANGUAGE_language_content***' 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 619715b905f2..feac2e80e5ba 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 @@ -44,6 +44,8 @@ display: table: node field: nid plugin_id: numeric + entity_type: node + entity_field: nid body: id: body table: node__body @@ -106,6 +108,8 @@ display: separator: ', ' field_api_classes: false plugin_id: field + entity_type: node + entity_field: body title: 'Test serialize' arguments: { } field_langcode: '***LANGUAGE_language_content***' 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 4836deccfe9d..a82936f3485f 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 @@ -54,6 +54,8 @@ display: empty_zero: false link_to_node: true plugin_id: node + entity_type: node + entity_field: title timestamp: id: timestamp table: node_counter @@ -232,12 +234,16 @@ display: operator: '' group: 1 plugin_id: boolean + entity_type: node + entity_field: status sorts: created: id: created table: node_field_data field: created order: DESC + entity_type: node + entity_field: created field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null page_1: diff --git a/core/modules/taxonomy/config/install/views.view.taxonomy_term.yml b/core/modules/taxonomy/config/install/views.view.taxonomy_term.yml index 26f32f8f7182..15f80ec43511 100644 --- a/core/modules/taxonomy/config/install/views.view.taxonomy_term.yml +++ b/core/modules/taxonomy/config/install/views.view.taxonomy_term.yml @@ -168,6 +168,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: language + entity_type: node + entity_field: langcode status: id: status table: taxonomy_index diff --git a/core/modules/taxonomy/src/Plugin/views/wizard/TaxonomyTerm.php b/core/modules/taxonomy/src/Plugin/views/wizard/TaxonomyTerm.php index 4d0ae02d2e9e..f2a1c05b6e19 100644 --- a/core/modules/taxonomy/src/Plugin/views/wizard/TaxonomyTerm.php +++ b/core/modules/taxonomy/src/Plugin/views/wizard/TaxonomyTerm.php @@ -36,6 +36,8 @@ class TaxonomyTerm extends WizardPluginBase { $display_options['fields']['name']['id'] = 'name'; $display_options['fields']['name']['table'] = 'taxonomy_term_field_data'; $display_options['fields']['name']['field'] = 'name'; + $display_options['fields']['name']['entity_type'] = 'taxonomy_term'; + $display_options['fields']['name']['entity_field'] = 'name'; $display_options['fields']['name']['label'] = ''; $display_options['fields']['name']['alter']['alter_text'] = 0; $display_options['fields']['name']['alter']['make_link'] = 0; diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.taxonomy_default_argument_test.yml b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.taxonomy_default_argument_test.yml index e8d3e306630f..cd075ce8f846 100644 --- a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.taxonomy_default_argument_test.yml +++ b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.taxonomy_default_argument_test.yml @@ -112,6 +112,8 @@ display: hide_alter_empty: true convert_spaces: false plugin_id: taxonomy + entity_type: taxonomy_term + entity_field: name filters: { } sorts: { } header: { } @@ -158,5 +160,7 @@ display: break_phrase: false not: false plugin_id: taxonomy + entity_type: taxonomy_term + entity_field: tid field_langcode: '***LANGUAGE_site_default***' field_langcode_add_to_query: null diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_field_filters.yml b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_field_filters.yml index 133ee54d8bf6..66b30fbae423 100644 --- a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_field_filters.yml +++ b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_field_filters.yml @@ -87,6 +87,8 @@ display: hide_alter_empty: true convert_spaces: false plugin_id: taxonomy + entity_type: taxonomy_term + entity_field: name filters: name: id: name @@ -124,6 +126,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: string + entity_type: taxonomy_term + entity_field: name sorts: { } title: 'Name filter page' header: { } @@ -180,6 +184,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: string + entity_type: taxonomy_term + entity_field: description defaults: filters: false filter_groups: false @@ -236,6 +242,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: string + entity_type: taxonomy_term + entity_field: description defaults: filters: false filter_groups: false @@ -292,6 +300,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: string + entity_type: taxonomy_term + entity_field: field_foo defaults: filters: false filter_groups: false @@ -348,6 +358,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: string + entity_type: taxonomy_term + entity_field: field_foo defaults: filters: false filter_groups: false @@ -414,6 +426,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: string + entity_type: taxonomy_term + entity_field: name defaults: filters: false filter_groups: false 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 7671e0f407d3..0157b91651fa 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 @@ -113,6 +113,8 @@ display: empty: '' hide_alter_empty: true plugin_id: node + entity_type: node + entity_field: title filters: status: value: true @@ -123,6 +125,8 @@ display: operator: '0' group: 1 plugin_id: boolean + entity_type: node + entity_field: status tid: id: tid table: taxonomy_index diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_groupwise_term.yml b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_groupwise_term.yml index 20bfe3b4ce45..30ed9f5a5858 100644 --- a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_groupwise_term.yml +++ b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_groupwise_term.yml @@ -28,12 +28,16 @@ display: id: name table: taxonomy_term_field_data plugin_id: taxonomy + entity_type: taxonomy_term + entity_field: name nid: field: nid id: nid relationship: tid_representative table: node plugin_id: node + entity_type: node + entity_field: nid pager: options: items_per_page: 10 @@ -64,6 +68,8 @@ display: order: DESC table: taxonomy_term_data plugin_id: standard + entity_type: taxonomy_term + entity_field: tid style: type: default title: test_groupwise diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_node_term_data.yml b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_node_term_data.yml index 2afdfb1ff781..c4c306d8d6dc 100644 --- a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_node_term_data.yml +++ b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_node_term_data.yml @@ -31,6 +31,8 @@ display: items_per_page: 25 table: taxonomy_term_data plugin_id: taxonomy + entity_type: taxonomy_term + entity_field: tid tid_1: default_argument_type: fixed field: tid @@ -43,6 +45,8 @@ display: items_per_page: 25 table: taxonomy_term_data plugin_id: taxonomy + entity_type: taxonomy_term + entity_field: tid cache: type: none exposed_form: @@ -75,6 +79,8 @@ display: order: DESC table: node plugin_id: standard + entity_type: node + entity_field: nid style: type: default row: diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_parent.yml b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_parent.yml index b80befbe796e..efaaa629678d 100644 --- a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_parent.yml +++ b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_parent.yml @@ -113,6 +113,8 @@ display: hide_alter_empty: true convert_spaces: false plugin_id: taxonomy + entity_type: taxonomy_term + entity_field: name filters: { } sorts: { } header: { } diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_tid_field.yml b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_tid_field.yml index 086793bde5aa..10ef4ef49562 100644 --- a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_tid_field.yml +++ b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_tid_field.yml @@ -131,6 +131,8 @@ display: link_to_taxonomy: true convert_spaces: false plugin_id: taxonomy + entity_type: taxonomy_term + entity_field: name filters: { } sorts: tid: @@ -145,6 +147,8 @@ display: expose: label: '' plugin_id: standard + entity_type: taxonomy_term + entity_field: tid header: { } footer: { } empty: { } 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 f87de544e56e..223ac1bcc5e8 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 @@ -104,6 +104,8 @@ display: hide_alter_empty: true link_to_node: true plugin_id: node + entity_type: node + entity_field: title filters: uid_touch_tracker: id: uid_touch_tracker @@ -143,6 +145,7 @@ display: default_group_multiple: { } group_items: { } plugin_id: tracker_user_uid + entity_type: node arguments: uid_touch_tracker: id: uid_touch_tracker @@ -177,5 +180,6 @@ display: fail: 'not found' validate_options: { } plugin_id: tracker_user_uid + entity_type: node field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null 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 1e1b74081648..ff62509461c6 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 @@ -188,6 +188,7 @@ display: empty_zero: false hide_alter_empty: true plugin_id: user_bulk_form + entity_type: user name: id: name table: users_field_data @@ -241,6 +242,8 @@ display: anonymous_text: '' format_username: true plugin_id: user_name + entity_type: user + entity_field: name status: id: status table: users_field_data @@ -294,6 +297,8 @@ display: type_custom_false: '' not: '0' plugin_id: boolean + entity_type: user + entity_field: status roles_target_id: id: roles_target_id table: user__roles @@ -397,6 +402,8 @@ display: custom_date_format: '' timezone: '' plugin_id: date + entity_type: user + entity_field: created access: id: access table: users_field_data @@ -449,6 +456,8 @@ display: custom_date_format: '' timezone: '' plugin_id: date + entity_type: user + entity_field: access edit_node: id: edit_node table: users @@ -499,6 +508,7 @@ display: hide_alter_empty: true text: Edit plugin_id: user_link_edit + entity_type: user dropbutton: id: dropbutton table: views @@ -607,6 +617,8 @@ display: hide_alter_empty: true link_to_user: false plugin_id: user_mail + entity_type: user + entity_field: mail filters: combine: id: combine @@ -775,6 +787,8 @@ display: operator: '=' value: '0' plugin_id: boolean + entity_type: user + entity_field: status uid_raw: id: uid_raw table: users @@ -814,6 +828,7 @@ display: default_group_multiple: { } group_items: { } plugin_id: numeric + entity_type: user sorts: created: id: created @@ -828,6 +843,8 @@ display: label: '' granularity: second plugin_id: date + entity_type: user + entity_field: created title: People empty: area_text_custom: diff --git a/core/modules/user/config/install/views.view.who_s_new.yml b/core/modules/user/config/install/views.view.who_s_new.yml index 310f06145c76..51ef2c5c92ab 100644 --- a/core/modules/user/config/install/views.view.who_s_new.yml +++ b/core/modules/user/config/install/views.view.who_s_new.yml @@ -88,6 +88,8 @@ display: hide_alter_empty: true anonymous_text: '' format_username: true + entity_type: user + entity_field: name filters: status: value: true @@ -98,6 +100,8 @@ display: operator: '0' group: 1 plugin_id: boolean + entity_type: user + entity_field: status access: id: access table: users_field_data @@ -138,6 +142,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: date + entity_type: user + entity_field: access sorts: created: id: created @@ -152,6 +158,8 @@ display: label: '' granularity: second plugin_id: date + entity_type: user + entity_field: created title: 'Who''s new' header: { } footer: { } diff --git a/core/modules/user/config/install/views.view.who_s_online.yml b/core/modules/user/config/install/views.view.who_s_online.yml index b00adfd60fc9..9c0faef384e5 100644 --- a/core/modules/user/config/install/views.view.who_s_online.yml +++ b/core/modules/user/config/install/views.view.who_s_online.yml @@ -95,6 +95,8 @@ display: hide_alter_empty: true anonymous_text: '' format_username: true + entity_type: user + entity_field: name filters: status: value: true @@ -105,6 +107,8 @@ display: operator: '0' group: 1 plugin_id: boolean + entity_type: user + entity_field: status access: id: access table: users_field_data @@ -147,6 +151,8 @@ display: default_group_multiple: { } group_items: { } plugin_id: date + entity_type: user + entity_field: access sorts: access: id: access @@ -161,6 +167,8 @@ display: label: '' granularity: second plugin_id: date + entity_type: user + entity_field: access title: 'Who''s online' header: result: diff --git a/core/modules/user/src/Plugin/views/wizard/Users.php b/core/modules/user/src/Plugin/views/wizard/Users.php index f6d96997f541..1052476d94e3 100644 --- a/core/modules/user/src/Plugin/views/wizard/Users.php +++ b/core/modules/user/src/Plugin/views/wizard/Users.php @@ -38,6 +38,8 @@ class Users extends WizardPluginBase { 'table' => 'users_field_data', 'field' => 'status', 'plugin_id' => 'boolean', + 'entity_type' => 'user', + 'entity_field' => 'status', ) ); @@ -58,6 +60,8 @@ class Users extends WizardPluginBase { $display_options['fields']['name']['id'] = 'name'; $display_options['fields']['name']['table'] = 'users_field_data'; $display_options['fields']['name']['field'] = 'name'; + $display_options['fields']['name']['entity_type'] = 'user'; + $display_options['fields']['name']['entity_field'] = 'name'; $display_options['fields']['name']['label'] = ''; $display_options['fields']['name']['alter']['alter_text'] = 0; $display_options['fields']['name']['alter']['make_link'] = 0; diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_field_permission.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_field_permission.yml index 34674c9bba42..6ae987e23898 100644 --- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_field_permission.yml +++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_field_permission.yml @@ -83,6 +83,8 @@ display: hide_alter_empty: true link_to_user: false plugin_id: user + entity_type: user + entity_field: uid permission: id: permission table: user__roles diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_filter_permission.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_filter_permission.yml index b05752836071..48a476186b28 100644 --- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_filter_permission.yml +++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_filter_permission.yml @@ -83,6 +83,8 @@ display: hide_alter_empty: true link_to_user: false plugin_id: user + entity_type: user + entity_field: uid filters: permission: id: permission @@ -136,5 +138,7 @@ display: expose: label: '' plugin_id: standard + entity_type: user + entity_field: uid field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_groupwise_user.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_groupwise_user.yml index 0ed9fd5ec8ad..427c7cb2d5a3 100644 --- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_groupwise_user.yml +++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_groupwise_user.yml @@ -29,12 +29,16 @@ display: id: name table: users_field_data plugin_id: user_name + entity_type: user + entity_field: name nid: field: nid id: nid relationship: uid_representative table: node plugin_id: node + entity_type: node + entity_field: nid filters: status: expose: @@ -45,6 +49,8 @@ display: table: users_field_data value: true plugin_id: boolean + entity_type: user + entity_field: status pager: options: items_per_page: 10 @@ -75,6 +81,8 @@ display: order: DESC table: users_field_data plugin_id: date + entity_type: user + entity_field: created style: type: default title: test_groupwise_user 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 b83989cc5a3d..10beeb4c3d24 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 @@ -46,6 +46,8 @@ display: link_to_node: false table: node_field_data plugin_id: node + entity_type: node + entity_field: title pager: options: id: 0 diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_bulk_form.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_bulk_form.yml index 460eef2e028f..3dd3a316eb9a 100644 --- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_bulk_form.yml +++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_bulk_form.yml @@ -28,11 +28,14 @@ display: table: users field: user_bulk_form plugin_id: user_bulk_form + entity_type: user name: id: name table: users_field_data field: name plugin_id: user_name + entity_type: user + entity_field: name sorts: uid: id: uid @@ -40,6 +43,8 @@ display: field: uid order: ASC plugin_id: user + entity_type: user + entity_field: uid filters: status: id: status @@ -48,6 +53,8 @@ display: operator: '=' value: true plugin_id: boolean + entity_type: user + entity_field: status field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null page_1: diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_changed.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_changed.yml index 4b65b37ba4c4..f5baa994fdc9 100644 --- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_changed.yml +++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_changed.yml @@ -31,6 +31,8 @@ display: id: uid table: users field: uid + entity_type: user + entity_field: uid changed: id: changed table: users_field_data @@ -38,6 +40,8 @@ display: label: 'Updated date' date_format: html_date plugin_id: date + entity_type: user + entity_field: changed filters: { } field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_data.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_data.yml index f4d517bef1b0..5bd259eaad61 100644 --- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_data.yml +++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_data.yml @@ -54,6 +54,8 @@ display: link_to_user: true overwrite_anonymous: false plugin_id: user_name + entity_type: user + entity_field: name data: id: data table: users @@ -105,6 +107,7 @@ display: data_module: views_test_config data_name: test_value_name plugin_id: user_data + entity_type: user filters: uid: value: @@ -116,6 +119,8 @@ display: operator: '0' group: 1 plugin_id: numeric + entity_type: user + entity_field: uid sorts: created: id: created @@ -123,5 +128,7 @@ display: field: created order: DESC plugin_id: date + entity_type: user + entity_field: created field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_name.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_name.yml index 3028438b9024..ccd87b7b0d3c 100644 --- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_name.yml +++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_name.yml @@ -31,6 +31,8 @@ display: id: uid table: users field: uid + entity_type: user + entity_field: uid filters: uid: id: uid @@ -45,6 +47,8 @@ display: remember_roles: authenticated: authenticated anonymous: '0' + entity_type: user + entity_field: uid field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null display_plugin: default 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 9bc74f64822f..6a3907d15089 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 @@ -47,6 +47,8 @@ display: overwrite_anonymous: false table: users_field_data plugin_id: user_name + entity_type: user + entity_field: name title: alter: absolute: false @@ -65,6 +67,8 @@ display: link_to_node: true table: node_field_data plugin_id: node + entity_type: node + entity_field: title uid: alter: absolute: false @@ -89,6 +93,8 @@ display: link_to_user: true table: users plugin_id: user + entity_type: user + entity_field: uid pager: options: items_per_page: 10 diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_uid_argument.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_uid_argument.yml index 1a2c1e6f19ca..945872903c3f 100644 --- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_uid_argument.yml +++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_uid_argument.yml @@ -20,6 +20,8 @@ display: table: users field: uid plugin_id: user + entity_type: user + entity_field: uid arguments: uid: id: uid @@ -28,6 +30,8 @@ display: title_enable: true title: '%1' plugin_id: user_uid + entity_type: user + entity_field: uid field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null display_plugin: default diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_role.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_role.yml index 372a82dc0d8f..40f21bc61eaf 100644 --- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_role.yml +++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_role.yml @@ -90,6 +90,8 @@ display: anonymous_text: '' format_username: true plugin_id: user_name + entity_type: user + entity_field: name roles_target_id: id: roles_target_id table: user__roles @@ -151,6 +153,8 @@ display: operator: '0' group: 1 plugin_id: boolean + entity_type: user + entity_field: status sorts: { } title: test_user_role field_langcode: '***LANGUAGE_language_content***' diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_user_name.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_user_name.yml index 0b474ad76535..9a9bac5fff5a 100644 --- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_user_name.yml +++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_user_name.yml @@ -40,6 +40,8 @@ display: overwrite_anonymous: false table: users_field_data plugin_id: user_name + entity_type: user + entity_field: name pager: type: full query: diff --git a/core/modules/views/config/schema/views.data_types.schema.yml b/core/modules/views/config/schema/views.data_types.schema.yml index 11be32393700..06f81ba2a127 100644 --- a/core/modules/views/config/schema/views.data_types.schema.yml +++ b/core/modules/views/config/schema/views.data_types.schema.yml @@ -327,6 +327,15 @@ views_handler: admin_label: type: label label: 'A string to identify the handler instance in the admin UI.' + entity_type: + type: string + label: 'The entity type' + entity_field: + type: string + label: 'The corresponding entity field' + plugin_id: + type: string + label: 'The plugin ID' views_argument: type: views_handler @@ -780,26 +789,8 @@ views_filter_group_item: label: 'Value' views_relationship: - type: mapping + type: views_handler mapping: - id: - type: string - label: 'ID' - table: - type: string - label: 'Table' - field: - type: string - label: 'UID' - plugin_id: - type: string - label: 'Plugin ID' - relationship: - type: string - label: 'Relationship' - group_type: - type: string - label: 'Group type' admin_label: type: string label: 'Administrative title' diff --git a/core/modules/views/src/EntityViewsData.php b/core/modules/views/src/EntityViewsData.php index 4bb38fe58f4c..9f361c7df5b3 100644 --- a/core/modules/views/src/EntityViewsData.php +++ b/core/modules/views/src/EntityViewsData.php @@ -127,7 +127,6 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac $revision_field = $this->entityType->getKey('revision'); // Setup base information of the views data. - $data[$base_table]['table']['entity type'] = $this->entityType->id(); $data[$base_table]['table']['group'] = $this->entityType->getLabel(); $data[$base_table]['table']['provider'] = $this->entityType->getProvider(); $data[$base_table]['table']['base'] = [ @@ -156,12 +155,10 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac 'field' => $base_field, 'type' => 'INNER' ]; - $data[$data_table]['table']['entity type'] = $this->entityType->id(); $data[$data_table]['table']['group'] = $this->entityType->getLabel(); $data[$data_table]['table']['provider'] = $this->entityType->getProvider(); } if ($revision_table) { - $data[$revision_table]['table']['entity type'] = $this->entityType->id(); $data[$revision_table]['table']['group'] = $this->t('@entity_type revision', ['@entity_type' => $this->entityType->getLabel()]); $data[$revision_table]['table']['provider'] = $this->entityType->getProvider(); $data[$revision_table]['table']['base'] = array( @@ -176,7 +173,6 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac ); if ($revision_data_table) { - $data[$revision_data_table]['table']['entity type'] = $this->entityType->id(); $data[$revision_data_table]['table']['group'] = $this->t('@entity_type revision', ['@entity_type' => $this->entityType->getLabel()]); $data[$revision_data_table]['table']['join'][$revision_table] = array( @@ -204,6 +200,12 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac } } + // Add the entity type key to each table generated. + $entity_type_id = $this->entityType->id(); + array_walk($data, function(&$table_data) use ($entity_type_id){ + $table_data['table']['entity type'] = $entity_type_id; + }); + return $data; } @@ -238,6 +240,8 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac foreach ($field_column_mapping as $field_column_name => $schema_field_name) { $views_field_name = ($multiple) ? $field_name . '__' . $field_column_name : $field_name; $table_data[$views_field_name] = $this->mapSingleFieldViewsData($table, $field_name, $field_definition_type, $field_column_name, $field_schema['columns'][$field_column_name]['type'], $first, $field_definition); + + $table_data[$views_field_name]['entity field'] = $field_name; $first = FALSE; } } diff --git a/core/modules/views/src/Plugin/ViewsHandlerManager.php b/core/modules/views/src/Plugin/ViewsHandlerManager.php index 146c6a8a5ec7..ac7abda6271c 100644 --- a/core/modules/views/src/Plugin/ViewsHandlerManager.php +++ b/core/modules/views/src/Plugin/ViewsHandlerManager.php @@ -91,7 +91,7 @@ class ViewsHandlerManager extends DefaultPluginManager implements FallbackPlugin if (isset($data[$field][$this->handlerType])) { $definition = $data[$field][$this->handlerType]; - foreach (array('group', 'title', 'title short', 'help', 'real field', 'real table') as $key) { + foreach (array('group', 'title', 'title short', 'help', 'real field', 'real table', 'entity field') as $key) { if (!isset($definition[$key])) { // First check the field level. if (!empty($data[$field][$key])) { diff --git a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php index 33f8f917e8a7..bbf06ce663f5 100644 --- a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php +++ b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php @@ -828,10 +828,14 @@ abstract class WizardPluginBase extends PluginBase implements WizardInterface { } } } + // @todo refactor the code to use ViewExecutable::addHandler, see + // https://drupal.org/node/2383157 $display_options['fields'][$default_field] = array( 'table' => $default_table, 'field' => $default_field, 'id' => $default_field, + 'entity_type' => isset($data[$default_field]['entity type']) ? $data[$default_field]['entity type'] : NULL, + 'entity_field' => isset($data[$default_field]['entity field']) ? $data[$default_field]['entity field'] : NULL, 'plugin_id' => $data[$default_field]['field']['id'], ); @@ -917,6 +921,8 @@ abstract class WizardPluginBase extends PluginBase implements WizardInterface { 'table' => $table, 'field' => $bundle_key, 'value' => $value, + 'entity_type' => isset($table_data['table']['entity type']) ? $table_data['table']['entity type'] : NULL, + 'entity_field' => isset($table_data[$bundle_key]['entity field']) ? $table_data[$bundle_key]['entity field'] : NULL, 'plugin_id' => $handler, ); } @@ -994,6 +1000,8 @@ abstract class WizardPluginBase extends PluginBase implements WizardInterface { 'table' => $table, 'field' => $column, 'order' => $sort, + 'entity_type' => isset($data['table']['entity type']) ? $data['table']['entity type'] : NULL, + 'entity_field' => isset($data[$column]['entity field']) ? $data[$column]['entity field'] : NULL, 'plugin_id' => $data[$column]['sort']['id'], ); } diff --git a/core/modules/views/src/Tests/ViewExecutableTest.php b/core/modules/views/src/Tests/ViewExecutableTest.php index 5b0fe2bf0b20..4b0e73f7e687 100644 --- a/core/modules/views/src/Tests/ViewExecutableTest.php +++ b/core/modules/views/src/Tests/ViewExecutableTest.php @@ -309,11 +309,6 @@ class ViewExecutableTest extends ViewUnitTestBase { $view->setResponse($new_response); $this->assertIdentical(spl_object_hash($view->getResponse()), spl_object_hash($new_response), 'New response object correctly set.'); - // Test the generateHandlerId() method. - $test_ids = array('test' => 'test', 'test_1' => 'test_1'); - $this->assertEqual($view->generateHandlerId('new', $test_ids), 'new'); - $this->assertEqual($view->generateHandlerId('test', $test_ids), 'test_2'); - // Test the getPath() method. $path = $this->randomMachineName(); $view->displayHandlers->get('page_1')->overrideOption('path', $path); diff --git a/core/modules/views/src/Tests/Wizard/NodeWizardTest.php b/core/modules/views/src/Tests/Wizard/NodeWizardTest.php new file mode 100644 index 000000000000..e76dba826e6c --- /dev/null +++ b/core/modules/views/src/Tests/Wizard/NodeWizardTest.php @@ -0,0 +1,51 @@ +drupalCreateContentType(array('type' => 'article')); + + $view = array(); + $view['label'] = $this->randomMachineName(16); + $view['id'] = strtolower($this->randomMachineName(16)); + $view['description'] = $this->randomMachineName(16); + $view['page[create]'] = FALSE; + $view['show[wizard_key]'] = 'node'; + $view['page[style][row_plugin]'] = 'titles'; + $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit')); + + $view_storage_controller = \Drupal::entityManager()->getStorage('view'); + /** @var \Drupal\views\Entity\View $view */ + $view = $view_storage_controller->load($view['id']); + + $display_options = $view->getDisplay('default')['display_options']; + // Ensure that the 'entity_table' and 'entity_field' properties are set + // property. + $this->assertEqual('node', $display_options['fields']['title']['entity_type']); + $this->assertEqual('title', $display_options['fields']['title']['entity_field']); + + $this->assertEqual('node', $display_options['filters']['status']['entity_type']); + $this->assertEqual('status', $display_options['filters']['status']['entity_field']); + + $this->assertEqual('node', $display_options['sorts']['created']['entity_type']); + $this->assertEqual('created', $display_options['sorts']['created']['entity_field']); + } + +} diff --git a/core/modules/views/src/ViewExecutable.php b/core/modules/views/src/ViewExecutable.php index 72cd5435ca91..0ca31daea317 100644 --- a/core/modules/views/src/ViewExecutable.php +++ b/core/modules/views/src/ViewExecutable.php @@ -417,6 +417,13 @@ class ViewExecutable { */ protected $showAdminLinks; + /** + * The views data. + * + * @var \Drupal\views\ViewsData + */ + protected $viewsData; + /** * Constructs a new ViewExecutable object. * @@ -424,12 +431,15 @@ class ViewExecutable { * The view config entity the actual information is stored on. * @param \Drupal\Core\Session\AccountInterface $user * The current user. + * @param \Drupal\views\ViewsData $views_data + * The views data. */ - public function __construct(ViewStorageInterface $storage, AccountInterface $user) { + public function __construct(ViewStorageInterface $storage, AccountInterface $user, ViewsData $views_data) { // Reference the storage and the executable to each other. $this->storage = $storage; $this->storage->set('executable', $this); $this->user = $user; + $this->viewsData = $views_data; // Add the default css for a view. $this->element['#attached']['library'][] = 'views/views.module'; @@ -1526,9 +1536,7 @@ class ViewExecutable { $this->is_attachment = TRUE; // Find out which other displays attach to the current one. foreach ($this->display_handler->getAttachedDisplays() as $id) { - // Create a clone for the attachments to manipulate. 'static' refers to the current class name. - $cloned_view = new static($this->storage, $this->user); - $cloned_view->setRequest($this->getRequest()); + $cloned_view = Views::executableFactory()->get($this->storage); $this->displayHandlers->get($id)->attachTo($cloned_view, $this->current_display, $this->element); } $this->is_attachment = FALSE; @@ -1900,6 +1908,7 @@ class ViewExecutable { $types = $this::getHandlerTypes(); $this->setDisplay($display_id); + $data = $this->viewsData->get($table); $fields = $this->displayHandlers->get($display_id)->getOption($types[$type]['plural']); if (empty($id)) { @@ -1915,8 +1924,14 @@ class ViewExecutable { 'field' => $field, ) + $options; + if (isset($data['table']['entity type'])) { + $fields[$id]['entity_type'] = $data['table']['entity type']; + } + if (isset($data[$field]['entity field'])) { + $fields[$id]['entity_field'] = $data[$field]['entity field']; + } + // Load the plugin ID if available. - $data = Views::viewsData()->get($table); if (isset($data[$field][$handler_type]['id'])) { $fields[$id]['plugin_id'] = $data[$field][$handler_type]['id']; } diff --git a/core/modules/views/src/ViewExecutableFactory.php b/core/modules/views/src/ViewExecutableFactory.php index 9ee217cd49f0..ed6bdd07e685 100644 --- a/core/modules/views/src/ViewExecutableFactory.php +++ b/core/modules/views/src/ViewExecutableFactory.php @@ -30,6 +30,13 @@ class ViewExecutableFactory { */ protected $requestStack; + /** + * The views data. + * + * @var \Drupal\views\ViewsData + */ + protected $viewsData; + /** * Constructs a new ViewExecutableFactory * @@ -37,10 +44,13 @@ class ViewExecutableFactory { * The current user. * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack * The request stack. + * @param \Drupal\views\ViewsData $views_data + * The views data. */ - public function __construct(AccountInterface $user, RequestStack $request_stack) { + public function __construct(AccountInterface $user, RequestStack $request_stack, ViewsData $views_data) { $this->user = $user; $this->requestStack = $request_stack; + $this->viewsData = $views_data; } /** @@ -53,7 +63,7 @@ class ViewExecutableFactory { * A ViewExecutable instance. */ public function get(ViewStorageInterface $view) { - $view = new ViewExecutable($view, $this->user); + $view = new ViewExecutable($view, $this->user, $this->viewsData); $view->setRequest($this->requestStack->getCurrentRequest()); return $view; } 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 71f537cb0385..b156d2d609a3 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 @@ -24,6 +24,8 @@ display: format: default_summary table: entity_test plugin_id: string + entity_type: entity_test + entity_field: name cache: type: none exposed_form: @@ -44,6 +46,8 @@ display: id: id table: entity_test plugin_id: numeric + entity_type: entity_test + entity_field: id group_by: true pager: type: some diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_alias.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_alias.yml index e4bdecd3b0c3..a6dbf3516749 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_alias.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_alias.yml @@ -42,6 +42,8 @@ display: overwrite_anonymous: false table: users_field_data plugin_id: user_name + entity_type: user + entity_field: name filters: uid_raw: admin_label: '' @@ -82,6 +84,7 @@ display: min: '' value: '1' plugin_id: numeric + entity_type: user pager: type: full query: 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 3cef48f0690c..a82ee33c42cb 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 @@ -23,6 +23,8 @@ display: id: uid table: node_field_data plugin_id: numeric + entity_type: node + entity_field: uid cache: type: none exposed_form: @@ -44,6 +46,8 @@ display: link_to_node: false table: node_field_data plugin_id: node + entity_type: node + entity_field: title pager: options: id: 0 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 cb2813b0fd33..4b8e8c846636 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 @@ -46,6 +46,8 @@ display: link_to_node: false table: node_field_data plugin_id: node + entity_type: node + entity_field: title pager: options: id: 0 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 08dacbb06f0d..7e5e4eb01ab2 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 @@ -25,18 +25,21 @@ display: id: created_day table: node_field_data plugin_id: date_day + entity_type: node created_fulldate: default_argument_type: fixed field: created_fulldate id: created_fulldate table: node_field_data plugin_id: date_fulldate + entity_type: node created_month: default_argument_type: fixed field: created_month id: created_month table: node_field_data plugin_id: date_month + entity_type: node cache: type: none empty: @@ -60,32 +63,43 @@ display: id: created table: node_field_data plugin_id: date + entity_type: node + entity_field: created nid: field: nid id: nid table: node plugin_id: node + entity_type: node + entity_field: nid path: field: path id: path table: node plugin_id: node_path + entity_type: node filters: nid: field: nid id: nid table: node plugin_id: numeric + entity_type: node + entity_field: nid status: field: status id: status table: node_field_data plugin_id: boolean + entity_type: node + entity_field: status title: field: title id: title table: node_field_data plugin_id: string + entity_type: node + entity_field: title footer: area: empty: false 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 3a0189bfe105..23ea953cba4b 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 @@ -27,6 +27,8 @@ display: id: title table: node_field_data plugin_id: node + entity_type: node + entity_field: title filters: status: field: status @@ -35,6 +37,8 @@ display: table: node_field_data value: true plugin_id: boolean + entity_type: node + entity_field: status pager: options: items_per_page: 10 @@ -52,6 +56,8 @@ display: order: DESC table: node_field_data plugin_id: date + entity_type: node + entity_field: created title: 'Test Display' field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null 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 3f1ac5d17c89..4ab684fcb905 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 @@ -40,6 +40,8 @@ display: link_to_node: true table: node_field_data plugin_id: node + entity_type: node + entity_field: title filters: status: expose: @@ -50,6 +52,8 @@ display: table: node_field_data value: true plugin_id: boolean + entity_type: node + entity_field: status pager: options: items_per_page: 10 @@ -67,6 +71,8 @@ display: order: DESC table: node_field_data plugin_id: date + entity_type: node + entity_field: created style: type: default title: test_display_feed 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 62048fb234de..01ba2cc2ca63 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 @@ -22,6 +22,8 @@ display: table: node field: nid plugin_id: numeric + entity_type: node + entity_field: nid field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null 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 5447c4299006..f55087f5bfb1 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 @@ -86,6 +86,8 @@ display: empty_zero: false hide_alter_empty: true link_to_node: false + entity_type: node + entity_field: nid title: id: title table: node_field_data @@ -104,6 +106,8 @@ display: hide_empty: false empty_zero: false link_to_node: true + entity_type: node + entity_field: title nothing: id: nothing table: views @@ -217,6 +221,8 @@ display: expose: operator: '0' group: 1 + entity_type: node + entity_field: status sorts: created: id: created @@ -224,6 +230,8 @@ display: field: created order: DESC plugin_id: date + entity_type: node + entity_field: created title: test_dropbutton field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_row_renderers.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_row_renderers.yml index 3aba1c03bd69..e9d37dfc1bca 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_row_renderers.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_row_renderers.yml @@ -38,5 +38,7 @@ display: table: node_field_data field: title plugin_id: standard + entity_type: node + entity_field: title field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null 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 a628e83bf29e..ad5f178a3d22 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,8 @@ display: table: node field: nid relationship: none + entity_type: node + entity_field: nid type: id: type table: node_field_data @@ -73,6 +75,8 @@ display: empty_zero: false hide_alter_empty: true plugin_id: node_type + entity_type: node + entity_field: type defaults: fields: false filters: false @@ -87,5 +91,7 @@ display: test_bundle: test_bundle test_bundle_2: test_bundle_2 plugin_id: bundle + entity_type: node + entity_field: type field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_admin_ui.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_admin_ui.yml index 892e10d73204..ee30393ba2b2 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_admin_ui.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_admin_ui.yml @@ -32,6 +32,8 @@ display: id: type table: node_field_data plugin_id: node_type + entity_type: node + entity_field: type body_value: id: body_value table: node__body @@ -72,6 +74,8 @@ display: operator: empty value: '' plugin_id: string + entity_type: node + entity_field: body pager: type: full sorts: @@ -80,6 +84,8 @@ display: id: created table: node_field_data plugin_id: date + entity_type: node + entity_field: created style: type: default row: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_block.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_block.yml index 86f14861c3b6..53983ff8b8fe 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_block.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_block.yml @@ -34,6 +34,8 @@ display: id: type table: node_field_data plugin_id: in_operator + entity_type: node + entity_field: type pager: type: full query: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_form_buttons.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_form_buttons.yml index 7d5978c06a54..f3ec0a970d50 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_form_buttons.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_form_buttons.yml @@ -34,6 +34,8 @@ display: id: type table: node_field_data plugin_id: in_operator + entity_type: node + entity_field: type pager: type: full query: 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 d61789db177c..27fa4e1f4e3d 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 @@ -28,18 +28,24 @@ display: id: cid table: comment plugin_id: comment + entity_type: comment + entity_field: cid nid: field: nid id: nid table: node relationship: node plugin_id: node + entity_type: node + entity_field: nid uid: field: uid id: uid table: users relationship: uid plugin_id: user + entity_type: user + entity_field: uid filter_groups: groups: { } operator: AND @@ -56,7 +62,7 @@ display: table: comment_field_data plugin_id: standard uid: - admin_label: 'Author' + admin_label: Author field: uid group_type: group id: uid diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_date_between.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_date_between.yml index 16bafa9bd5b9..57cc2f5c1c82 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_date_between.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_date_between.yml @@ -26,12 +26,16 @@ display: id: nid table: node plugin_id: node + entity_type: node + entity_field: nid filters: created: field: created id: created table: node_field_data plugin_id: date + entity_type: node + entity_field: created pager: type: full query: 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 67580e2c6b3f..82037bcc65d6 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 @@ -31,6 +31,8 @@ display: label: '' table: node_field_data plugin_id: node + entity_type: node + entity_field: title filters: status: expose: @@ -41,6 +43,8 @@ display: table: node_field_data value: true plugin_id: boolean + entity_type: node + entity_field: status pager: type: full query: 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 ee2d05a3e1b3..c374195bedbc 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 @@ -31,6 +31,8 @@ display: label: '' table: node_field_data plugin_id: node + entity_type: node + entity_field: title filter_groups: groups: 1: AND @@ -44,6 +46,8 @@ display: value: value: '1' plugin_id: numeric + entity_type: node + entity_field: nid nid_1: field: nid group: 2 @@ -52,6 +56,8 @@ display: value: value: '2' plugin_id: numeric + entity_type: node + entity_field: nid status: expose: operator: '0' @@ -61,6 +67,8 @@ display: table: node_field_data value: true plugin_id: boolean + entity_type: node + entity_field: status pager: options: items_per_page: 10 @@ -74,6 +82,8 @@ display: order: DESC table: node_field_data plugin_id: date + entity_type: node + entity_field: created title: test_filter_groups style: type: default @@ -103,6 +113,8 @@ display: value: value: '1' plugin_id: numeric + entity_type: node + entity_field: nid nid_1: field: nid group: 2 @@ -111,6 +123,8 @@ display: value: value: '2' plugin_id: numeric + entity_type: node + entity_field: nid status: expose: operator: '0' @@ -120,6 +134,8 @@ display: table: node_field_data value: true plugin_id: boolean + entity_type: node + entity_field: status path: test-filter-groups field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_in_operator_ui.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_in_operator_ui.yml index a95a9843851b..274669949925 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_in_operator_ui.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_in_operator_ui.yml @@ -31,6 +31,8 @@ display: id: type table: node_field_data plugin_id: in_operator + entity_type: node + entity_field: type pager: type: full style: 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 0a730b46bafc..c7205ecf443a 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 @@ -40,7 +40,7 @@ display: fields: title: id: title - table: node + table: node_field_data field: title plugin_id: node label: '' @@ -56,6 +56,8 @@ display: hide_empty: false empty_zero: false link_to_node: true + entity_type: node + entity_field: title filters: status: value: true @@ -66,6 +68,8 @@ display: expose: operator: '0' group: 1 + entity_type: node + entity_field: status sorts: created: id: created @@ -73,6 +77,8 @@ display: field: created order: DESC plugin_id: date + entity_type: node + entity_field: created title: test_get_attach_displays field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null 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 9f5c4630e1d0..9effcbcbeaf5 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 @@ -31,6 +31,8 @@ display: items_per_page: 25 table: node_field_data plugin_id: string + entity_type: node + entity_field: title cache: type: none exposed_form: @@ -42,6 +44,8 @@ display: label: '' table: node_field_data plugin_id: node + entity_type: node + entity_field: title pager: type: full query: diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_by_count.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_by_count.yml index 0226ad249c02..ac85982ec110 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_by_count.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_by_count.yml @@ -35,6 +35,8 @@ display: id: id table: entity_test plugin_id: numeric + entity_type: entity_test + entity_field: id name: alter: alter_text: false @@ -50,6 +52,8 @@ display: id: name table: entity_test plugin_id: standard + entity_type: entity_test + entity_field: name group_by: true pager: type: some diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_by_in_filters.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_by_in_filters.yml index 53cb780ce82c..bd57f7cb3077 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_by_in_filters.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_by_in_filters.yml @@ -34,6 +34,8 @@ display: id: name table: entity_test plugin_id: standard + entity_type: entity_test + entity_field: name filters: id: field: id @@ -44,6 +46,8 @@ display: value: value: '3' plugin_id: numeric + entity_type: entity_test + entity_field: id group_by: true pager: type: some diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_groupwise_term_ui.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_groupwise_term_ui.yml index bd2d65e92614..872ab9ef1049 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_groupwise_term_ui.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_groupwise_term_ui.yml @@ -28,12 +28,16 @@ display: id: name table: taxonomy_term_field_data plugin_id: taxonomy + entity_type: taxonomy_term + entity_field: name nid: field: nid id: nid relationship: tid_representative table: node plugin_id: node + entity_type: node + entity_field: nid pager: options: items_per_page: 10 @@ -64,6 +68,8 @@ display: order: DESC table: taxonomy_term_data plugin_id: standard + entity_type: taxonomy_term + entity_field: tid style: type: default title: test_groupwise 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 8ca9214d9ca6..1fd3c3f8fb9b 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 @@ -20,6 +20,8 @@ display: table: node_field_data field: title plugin_id: node + entity_type: node + entity_field: title relationships: comment_cid: id: comment_cid 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 b8b74cd9a915..79f5361afcf5 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 @@ -53,6 +53,8 @@ display: hide_empty: false empty_zero: false link_to_node: true + entity_type: node + entity_field: title timestamp: id: timestamp table: history @@ -114,6 +116,8 @@ display: expose: operator: '0' group: 1 + entity_type: node + entity_field: status sorts: created: id: created @@ -121,6 +125,8 @@ display: field: created plugin_id: date order: DESC + entity_type: node + entity_field: created field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null page_1: @@ -178,6 +184,8 @@ display: default_group: All default_group_multiple: { } group_items: { } + entity_type: node + entity_field: status timestamp: id: timestamp table: history 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 bd2334c5e16c..4ab699f052fa 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 @@ -35,7 +35,7 @@ display: fields: title: id: title - table: node + table: node_field_data field: title label: '' alter: @@ -51,6 +51,8 @@ display: empty_zero: false link_to_node: true plugin_id: node + entity_type: node + entity_field: title filters: status: value: true @@ -61,12 +63,16 @@ display: operator: '0' group: 1 plugin_id: boolean + entity_type: node + entity_field: status sorts: created: id: created table: node field: created order: DESC + entity_type: node + entity_field: created empty: http_status_code: id: http_status_code 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 b25021eedb7d..af8e374d243c 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 @@ -54,7 +54,7 @@ display: fields: title: id: title - table: node + table: node_field_data field: title label: '' alter: @@ -70,6 +70,8 @@ display: empty_zero: false link_to_node: true plugin_id: node + entity_type: node + entity_field: title filters: { } sorts: nid: @@ -78,6 +80,8 @@ display: field: nid plugin_id: standard order: ASC + entity_type: node + entity_field: nid title: test_mini_pager filter_groups: operator: AND diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_plugin_dependencies.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_plugin_dependencies.yml index d4b73cda05aa..52edf70165fa 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_plugin_dependencies.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_plugin_dependencies.yml @@ -40,6 +40,8 @@ display: id: cid table: comment plugin_id: comment + entity_type: comment + entity_field: cid filter_groups: groups: { } operator: AND 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 e77805ebc168..d93ac85bd279 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 @@ -56,6 +56,8 @@ display: empty_zero: false link_to_node: true plugin_id: node + entity_type: node + entity_field: title filters: status: value: true @@ -66,6 +68,8 @@ display: operator: '0' group: 1 plugin_id: boolean + entity_type: node + entity_field: status sorts: created: id: created @@ -73,6 +77,8 @@ display: field: created order: DESC plugin_id: date + entity_type: node + entity_field: created title: test_redirect_view field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_relationship_dependency.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_relationship_dependency.yml index 15ec6bb919ce..b6b43c3f2e64 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_relationship_dependency.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_relationship_dependency.yml @@ -28,6 +28,8 @@ display: id: cid table: comment plugin_id: comment + entity_type: comment + entity_field: cid filter_groups: groups: { } operator: AND 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 1e89c1a02864..a7729b107f8d 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 @@ -90,6 +90,8 @@ display: empty: '' hide_alter_empty: true plugin_id: node + entity_type: node + entity_field: title filters: status: value: true @@ -100,6 +102,8 @@ display: operator: '' group: 1 plugin_id: boolean + entity_type: node + entity_field: status sorts: created: id: created @@ -114,6 +118,8 @@ display: label: '' granularity: second plugin_id: date + entity_type: node + entity_field: created title: '' header: { } footer: { } @@ -139,6 +145,8 @@ display: operator: '' group: 1 plugin_id: boolean + entity_type: node + entity_field: status keys: id: keys table: node_search_index @@ -204,6 +212,8 @@ display: operator: '' group: 1 plugin_id: boolean + entity_type: node + entity_field: status defaults: filters: false filter_groups: false diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_style_opml.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_style_opml.yml index b1ed7baf10c1..55f399d757be 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_style_opml.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_style_opml.yml @@ -85,6 +85,8 @@ display: hide_alter_empty: true display_as_link: false plugin_id: aggregator_title_link + entity_type: aggregator_feed + entity_field: title url: id: url table: aggregator_feed @@ -135,6 +137,8 @@ display: hide_alter_empty: true display_as_link: false plugin_id: url + entity_type: aggregator_feed + entity_field: url description: id: description table: aggregator_feed @@ -184,6 +188,8 @@ display: empty_zero: false hide_alter_empty: true plugin_id: xss + entity_type: aggregator_feed + entity_field: description modified: id: modified table: aggregator_feed @@ -236,6 +242,8 @@ display: custom_date_format: '' timezone: '' plugin_id: date + entity_type: aggregator_feed + entity_field: modified filters: { } sorts: { } title: test_style_opml 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 b83e7a817af8..4399c4248911 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 @@ -37,6 +37,8 @@ display: id: nid table: node plugin_id: numeric + entity_type: node + entity_field: nid title: id: title table: node_field_data @@ -53,6 +55,8 @@ display: hide_alter_empty: true link_to_node: true plugin_id: node + entity_type: node + entity_field: title filters: type: id: type @@ -92,6 +96,8 @@ display: 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_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 772acad4adc7..a9cdc0f03df4 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 @@ -37,6 +37,8 @@ display: link_to_node: false table: node_field_data plugin_id: node + entity_type: node + entity_field: title pager: options: id: 0 diff --git a/core/modules/views/tests/src/Unit/EntityViewsDataTest.php b/core/modules/views/tests/src/Unit/EntityViewsDataTest.php index 476a19949bdc..e9c5a6085224 100644 --- a/core/modules/views/tests/src/Unit/EntityViewsDataTest.php +++ b/core/modules/views/tests/src/Unit/EntityViewsDataTest.php @@ -35,7 +35,7 @@ class EntityViewsDataTest extends UnitTestCase { /** * Entity info to use in this test. * - * @var \Drupal\Core\Entity\EntityTypeInterface|\Drupal\views\Tests\TestEntityType + * @var \Drupal\Core\Entity\EntityTypeInterface|\Drupal\Tests\views\Unit\TestEntityType */ protected $baseEntityType; @@ -70,7 +70,7 @@ class EntityViewsDataTest extends UnitTestCase { /** * The tested entity views controller. * - * @var \Drupal\views\Tests\TestEntityViewsData + * @var \Drupal\Tests\views\Unit\TestEntityViewsData */ protected $viewsData; @@ -342,19 +342,29 @@ class EntityViewsDataTest extends UnitTestCase { $data = $this->viewsData->getViewsData(); $this->assertNumericField($data['entity_test']['id']); + $this->assertField($data['entity_test']['id'], 'id'); $this->assertUuidField($data['entity_test']['uuid']); + $this->assertField($data['entity_test']['uuid'], 'uuid'); $this->assertStringField($data['entity_test']['type']); + $this->assertEquals('type', $data['entity_test']['type']['entity field']); $this->assertLanguageField($data['entity_test']['langcode']); + $this->assertField($data['entity_test']['langcode'], 'langcode'); $this->assertEquals('Original language', $data['entity_test']['langcode']['title']); $this->assertStringField($data['entity_test']['name']); + $this->assertField($data['entity_test']['name'], 'name'); $this->assertLongTextField($data['entity_test'], 'description'); + $this->assertField($data['entity_test']['description__value'], 'description'); + $this->assertField($data['entity_test']['description__format'], 'description'); $this->assertUriField($data['entity_test']['homepage']); + $this->assertField($data['entity_test']['homepage'], 'homepage'); $this->assertEntityReferenceField($data['entity_test']['user_id']); + $this->assertField($data['entity_test']['user_id'], 'user_id'); + $relationship = $data['entity_test']['user_id']['relationship']; $this->assertEquals('users', $relationship['base']); $this->assertEquals('uid', $relationship['base field']); @@ -426,12 +436,16 @@ class EntityViewsDataTest extends UnitTestCase { // Check the base fields. $this->assertNumericField($data['entity_test_mul']['id']); + $this->assertField($data['entity_test_mul']['id'], 'id'); $this->assertUuidField($data['entity_test_mul']['uuid']); + $this->assertField($data['entity_test_mul']['uuid'], 'uuid'); $this->assertBundleField($data['entity_test_mul']['type']); + $this->assertField($data['entity_test_mul']['type'], 'type'); $this->assertFalse(isset($data['entity_test_mul']['type']['relationship'])); $this->assertLanguageField($data['entity_test_mul']['langcode']); + $this->assertField($data['entity_test_mul']['langcode'], 'langcode'); // Also ensure that field_data only fields don't appear on the base table. $this->assertFalse(isset($data['entity_test_mul']['name'])); $this->assertFalse(isset($data['entity_test_mul']['description'])); @@ -442,17 +456,24 @@ class EntityViewsDataTest extends UnitTestCase { // Check the data fields. $this->assertNumericField($data['entity_test_mul_property_data']['id']); + $this->assertField($data['entity_test_mul_property_data']['id'], 'id'); $this->assertLanguageField($data['entity_test_mul_property_data']['langcode']); + $this->assertField($data['entity_test_mul_property_data']['langcode'], 'langcode'); $this->assertEquals('Translation language', $data['entity_test_mul_property_data']['langcode']['title']); $this->assertStringField($data['entity_test_mul_property_data']['name']); + $this->assertField($data['entity_test_mul_property_data']['name'], 'name'); $this->assertLongTextField($data['entity_test_mul_property_data'], 'description'); + $this->assertField($data['entity_test_mul_property_data']['description__value'], 'description'); + $this->assertField($data['entity_test_mul_property_data']['description__format'], 'description'); $this->assertUriField($data['entity_test_mul_property_data']['homepage']); + $this->assertField($data['entity_test_mul_property_data']['homepage'], 'homepage'); $this->assertEntityReferenceField($data['entity_test_mul_property_data']['user_id']); + $this->assertField($data['entity_test_mul_property_data']['user_id'], 'user_id'); $relationship = $data['entity_test_mul_property_data']['user_id']['relationship']; $this->assertEquals('users', $relationship['base']); $this->assertEquals('uid', $relationship['base field']); @@ -513,9 +534,13 @@ class EntityViewsDataTest extends UnitTestCase { // Check the base fields. $this->assertNumericField($data['entity_test_mulrev']['id']); + $this->assertField($data['entity_test_mulrev']['id'], 'id'); $this->assertNumericField($data['entity_test_mulrev']['revision_id']); + $this->assertField($data['entity_test_mulrev']['revision_id'], 'revision_id'); $this->assertUuidField($data['entity_test_mulrev']['uuid']); + $this->assertField($data['entity_test_mulrev']['uuid'], 'uuid'); $this->assertStringField($data['entity_test_mulrev']['type']); + $this->assertField($data['entity_test_mulrev']['type'], 'type'); // Also ensure that field_data only fields don't appear on the base table. $this->assertFalse(isset($data['entity_test_mulrev']['name'])); @@ -528,9 +553,12 @@ class EntityViewsDataTest extends UnitTestCase { // Check the revision fields. $this->assertNumericField($data['entity_test_mulrev_revision']['id']); + $this->assertField($data['entity_test_mulrev_revision']['id'], 'id'); $this->assertNumericField($data['entity_test_mulrev_revision']['revision_id']); + $this->assertField($data['entity_test_mulrev_revision']['revision_id'], 'revision_id'); $this->assertLanguageField($data['entity_test_mulrev_revision']['langcode']); + $this->assertField($data['entity_test_mulrev_revision']['langcode'], 'langcode'); $this->assertEquals('Original language', $data['entity_test_mulrev_revision']['langcode']['title']); // Also ensure that field_data only fields don't appear on the revision table. @@ -543,35 +571,61 @@ class EntityViewsDataTest extends UnitTestCase { // Check the data fields. $this->assertNumericField($data['entity_test_mulrev_property_data']['id']); + $this->assertField($data['entity_test_mulrev_property_data']['id'], 'id'); $this->assertLanguageField($data['entity_test_mulrev_property_data']['langcode']); + $this->assertField($data['entity_test_mulrev_property_data']['langcode'], 'langcode'); $this->assertStringField($data['entity_test_mulrev_property_data']['name']); + $this->assertField($data['entity_test_mulrev_property_data']['name'], 'name'); $this->assertLongTextField($data['entity_test_mulrev_property_data'], 'description'); + $this->assertField($data['entity_test_mulrev_property_data']['description__value'], 'description'); + $this->assertField($data['entity_test_mulrev_property_data']['description__format'], 'description'); $this->assertUriField($data['entity_test_mulrev_property_data']['homepage']); + $this->assertField($data['entity_test_mulrev_property_data']['homepage'], 'homepage'); $this->assertEntityReferenceField($data['entity_test_mulrev_property_data']['user_id']); + $this->assertField($data['entity_test_mulrev_property_data']['user_id'], 'user_id'); $relationship = $data['entity_test_mulrev_property_data']['user_id']['relationship']; $this->assertEquals('users', $relationship['base']); $this->assertEquals('uid', $relationship['base field']); // Check the property data fields. $this->assertNumericField($data['entity_test_mulrev_property_revision']['id']); + $this->assertField($data['entity_test_mulrev_property_revision']['id'], 'id'); $this->assertLanguageField($data['entity_test_mulrev_property_revision']['langcode']); + $this->assertField($data['entity_test_mulrev_property_revision']['langcode'], 'langcode'); $this->assertEquals('Translation language', $data['entity_test_mulrev_property_revision']['langcode']['title']); $this->assertStringField($data['entity_test_mulrev_property_revision']['name']); + $this->assertField($data['entity_test_mulrev_property_revision']['name'], 'name'); $this->assertLongTextField($data['entity_test_mulrev_property_revision'], 'description'); + $this->assertField($data['entity_test_mulrev_property_revision']['description__value'], 'description'); + $this->assertField($data['entity_test_mulrev_property_revision']['description__format'], 'description'); $this->assertUriField($data['entity_test_mulrev_property_revision']['homepage']); + $this->assertField($data['entity_test_mulrev_property_revision']['homepage'], 'homepage'); $this->assertEntityReferenceField($data['entity_test_mulrev_property_revision']['user_id']); + $this->assertField($data['entity_test_mulrev_property_revision']['user_id'], 'user_id'); $relationship = $data['entity_test_mulrev_property_revision']['user_id']['relationship']; $this->assertEquals('users', $relationship['base']); $this->assertEquals('uid', $relationship['base field']); } + /** + * Tests generic stuff per field. + * + * @param array $data + * The views data to check. + * @param string $field_name + * The entity field name. + */ + protected function assertField($data, $field_name) { + $this->assertEquals($field_name, $data['entity field']); + } + /** * Tests views data for a string field. * diff --git a/core/modules/views/tests/src/Unit/Plugin/area/ResultTest.php b/core/modules/views/tests/src/Unit/Plugin/area/ResultTest.php index 651ef08e6202..a289d8e2991a 100644 --- a/core/modules/views/tests/src/Unit/Plugin/area/ResultTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/area/ResultTest.php @@ -43,7 +43,10 @@ class ResultTest extends UnitTestCase { ->will($this->returnValue('ResultTest')); $user = $this->getMock('Drupal\Core\Session\AccountInterface'); - $this->view = new ViewExecutable($storage, $user); + $views_data = $this->getMockBuilder('Drupal\views\ViewsData') + ->disableOriginalConstructor() + ->getMock(); + $this->view = new ViewExecutable($storage, $user, $views_data); $this->resultHandler = new Result(array(), 'result', array()); $this->resultHandler->view = $this->view; diff --git a/core/modules/views/tests/src/Unit/Plugin/field/CounterTest.php b/core/modules/views/tests/src/Unit/Plugin/field/CounterTest.php index 72516cf5de66..959ce3d7e8d4 100644 --- a/core/modules/views/tests/src/Unit/Plugin/field/CounterTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/field/CounterTest.php @@ -72,7 +72,10 @@ class CounterTest extends UnitTestCase { $storage = new View($config, 'view'); $user = $this->getMock('Drupal\Core\Session\AccountInterface'); - $this->view = $this->getMock('Drupal\views\ViewExecutable', NULL, array($storage, $user)); + $views_data = $this->getMockBuilder('Drupal\views\ViewsData') + ->disableOriginalConstructor() + ->getMock(); + $this->view = $this->getMock('Drupal\views\ViewExecutable', NULL, array($storage, $user, $views_data)); $this->display = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase') ->disableOriginalConstructor() diff --git a/core/modules/views/tests/src/Unit/ViewExecutableFactoryTest.php b/core/modules/views/tests/src/Unit/ViewExecutableFactoryTest.php index d9130d507da2..730dd378754f 100644 --- a/core/modules/views/tests/src/Unit/ViewExecutableFactoryTest.php +++ b/core/modules/views/tests/src/Unit/ViewExecutableFactoryTest.php @@ -46,6 +46,13 @@ class ViewExecutableFactoryTest extends UnitTestCase { */ protected $viewExecutableFactory; + /** + * The mocked views data. + * + * @var \Drupal\views\ViewsData|\PHPUnit_Framework_MockObject_MockObject + */ + protected $viewsData; + /** * {@inheritdoc} */ @@ -55,7 +62,10 @@ class ViewExecutableFactoryTest extends UnitTestCase { $this->user = $this->getMock('Drupal\Core\Session\AccountInterface'); $this->requestStack = new RequestStack(); $this->view = $this->getMock('Drupal\views\ViewStorageInterface'); - $this->viewExecutableFactory = new ViewExecutableFactory($this->user, $this->requestStack); + $this->viewsData = $this->getMockBuilder('Drupal\views\ViewsData') + ->disableOriginalConstructor() + ->getMock(); + $this->viewExecutableFactory = new ViewExecutableFactory($this->user, $this->requestStack, $this->viewsData); } /** diff --git a/core/modules/views/tests/src/Unit/ViewExecutableUnitTest.php b/core/modules/views/tests/src/Unit/ViewExecutableUnitTest.php index 13042dfbf807..ecabe3ffa9a8 100644 --- a/core/modules/views/tests/src/Unit/ViewExecutableUnitTest.php +++ b/core/modules/views/tests/src/Unit/ViewExecutableUnitTest.php @@ -10,6 +10,7 @@ namespace Drupal\Tests\views\Unit; use Drupal\Tests\UnitTestCase; use Drupal\views\Entity\View; use Drupal\views\ViewExecutable; +use Symfony\Component\DependencyInjection\ContainerBuilder; /** * @coversDefaultClass \Drupal\views\ViewExecutable @@ -17,39 +18,76 @@ use Drupal\views\ViewExecutable; */ class ViewExecutableUnitTest extends UnitTestCase { + /** + * The mocked views data. + * + * @var \Drupal\views\ViewsData|\PHPUnit_Framework_MockObject_MockObject + */ + protected $viewsData; + + /** + * The mocked user. + * + * @var \Drupal\Core\Session\AccountInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $user; + + /** + * A mocked display collection. + * + * @var \Drupal\views\DisplayPluginCollection|\PHPUnit_Framework_MockObject_MockObject + */ + protected $displayCollection; + + /** + * The mocked view executable. + * + * @var \Drupal\views\ViewExecutableFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $viewExecutableFactory; + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + + $this->viewsData = $this->getMockBuilder('Drupal\views\ViewsData') + ->disableOriginalConstructor() + ->getMock(); + $this->user = $this->getMock('Drupal\Core\Session\AccountInterface'); + + $this->displayCollection = $this->getMockBuilder('Drupal\views\DisplayPluginCollection') + ->disableOriginalConstructor() + ->getMock(); + + $this->viewExecutableFactory = $this->getMockBuilder('Drupal\views\ViewExecutableFactory') + ->disableOriginalConstructor() + ->getMock(); + + $translation = $this->getStringTranslationStub(); + $container = new ContainerBuilder(); + $container->set('string_translation', $translation); + $container->set('views.executable', $this->viewExecutableFactory); + \Drupal::setContainer($container); + } + /** * Tests the buildThemeFunctions() method. */ public function testBuildThemeFunctions() { - $config = array( - 'id' => 'test_view', - 'tag' => 'OnE, TWO, and three', - 'display' => array( - 'default' => array( - 'id' => 'default', - 'display_plugin' => 'default', - 'display_title' => 'Default', - ), - ), - ); - - $storage = new View($config, 'view'); - $user = $this->getMock('Drupal\Core\Session\AccountInterface'); - $view = new ViewExecutable($storage, $user); + /** @var \Drupal\views\ViewExecutable|\PHPUnit_Framework_MockObject_MockObject $view */ + /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit_Framework_MockObject_MockObject $display */ + list($view, $display) = $this->setupBaseViewAndDisplay(); + unset($view->display_handler); $expected = array( 'test_hook__test_view', 'test_hook' ); $this->assertEquals($expected, $view->buildThemeFunctions('test_hook')); - // Add a mock display. - $display = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase') - ->disableOriginalConstructor() - ->getMock(); - $display->display = $config['display']['default']; $view->display_handler = $display; - $expected = array( 'test_hook__test_view__default', 'test_hook__default', @@ -78,4 +116,189 @@ class ViewExecutableUnitTest extends UnitTestCase { $this->assertEquals($expected, $view->buildThemeFunctions('test_hook')); } + /** + * Tests the generateHandlerId method(). + * + * @covers ::generateHandlerId() + */ + public function testGenerateHandlerId() { + // Test the generateHandlerId() method. + $test_ids = ['test' => 'test', 'test_1' => 'test_1']; + $this->assertEquals(ViewExecutable::generateHandlerId('new', $test_ids), 'new'); + $this->assertEquals(ViewExecutable::generateHandlerId('test', $test_ids), 'test_2'); + } + + /** + * Tests the addHandler method(). + * + * @covers ::addHandler() + */ + public function testAddHandler() { + /** @var \Drupal\views\ViewExecutable|\PHPUnit_Framework_MockObject_MockObject $view */ + /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit_Framework_MockObject_MockObject $display */ + list($view, $display) = $this->setupBaseViewAndDisplay(); + + $views_data = []; + $views_data['test_field'] = [ + 'field' => ['id' => 'standard'], + 'filter' => ['id' => 'standard'], + 'argument' => ['id' => 'standard'], + 'sort' => ['id' => 'standard'], + ]; + + $this->viewsData->expects($this->atLeastOnce()) + ->method('get') + ->with('test_entity') + ->willReturn($views_data); + + foreach (['field', 'filter', 'argument', 'sort'] as $handler_type) { + $display->expects($this->atLeastOnce()) + ->method('setOption') + ->with($this->callback(function($argument) { + return $argument; + }), ['test_field' => [ + 'id' => 'test_field', + 'table' => 'test_entity', + 'field' => 'test_field', + 'plugin_id' => 'standard', + ]]); + } + + foreach (['field', 'filter', 'argument', 'sort'] as $handler_type) { + $view->addHandler('default', $handler_type, 'test_entity', 'test_field'); + } + } + + /** + * Tests the addHandler method() with an entity field. + * + * @covers ::addHandler() + */ + public function testAddHandlerWithEntityField() { + /** @var \Drupal\views\ViewExecutable|\PHPUnit_Framework_MockObject_MockObject $view */ + /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit_Framework_MockObject_MockObject $display */ + list($view, $display) = $this->setupBaseViewAndDisplay(); + + $views_data = []; + $views_data['table']['entity type'] = 'test_entity_type'; + $views_data['test_field'] = [ + 'entity field' => 'test_field', + 'field' => ['id' => 'standard'], + 'filter' => ['id' => 'standard'], + 'argument' => ['id' => 'standard'], + 'sort' => ['id' => 'standard'], + ]; + + $this->viewsData->expects($this->atLeastOnce()) + ->method('get') + ->with('test_entity') + ->willReturn($views_data); + + foreach (['field', 'filter', 'argument', 'sort'] as $handler_type) { + $display->expects($this->atLeastOnce()) + ->method('setOption') + ->with($this->callback(function($argument) { + return $argument; + }), ['test_field' => [ + 'id' => 'test_field', + 'table' => 'test_entity', + 'field' => 'test_field', + 'entity_type' => 'test_entity_type', + 'entity_field' => 'test_field', + 'plugin_id' => 'standard', + ]]); + } + + foreach (['field', 'filter', 'argument', 'sort'] as $handler_type) { + $view->addHandler('default', $handler_type, 'test_entity', 'test_field'); + } + } + + /** + * Tests attachDisplays(). + * + * @covers ::attachDisplays() + */ + public function testAttachDisplays() { + /** @var \Drupal\views\ViewExecutable|\PHPUnit_Framework_MockObject_MockObject $view */ + /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit_Framework_MockObject_MockObject $display */ + list($view, $display) = $this->setupBaseViewAndDisplay(); + + $display->expects($this->atLeastOnce()) + ->method('acceptAttachments') + ->willReturn(TRUE); + $display->expects($this->atLeastOnce()) + ->method('getAttachedDisplays') + ->willReturn(['page_1']); + + $cloned_view = $this->getMockBuilder('Drupal\views\ViewExecutable') + ->disableOriginalConstructor() + ->getMock(); + $this->viewExecutableFactory->expects($this->atLeastOnce()) + ->method('get') + ->willReturn($cloned_view); + + $page_display = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase') + ->disableOriginalConstructor() + ->getMock(); + + $display_collection = $this->getMockBuilder('Drupal\views\DisplayPluginCollection') + ->disableOriginalConstructor() + ->getMock(); + + $display_collection->expects($this->atLeastOnce()) + ->method('get') + ->with('page_1') + ->willReturn($page_display); + $view->displayHandlers = $display_collection; + + // Setup the expectations. + $page_display->expects($this->once()) + ->method('attachTo') + ->with($cloned_view, 'default', $view->element); + + $view->attachDisplays(); + } + + /** + * Setups a view executable and default display. + * + * @return array + * Returns the view executable and default display. + */ + protected function setupBaseViewAndDisplay() { + $config = array( + 'id' => 'test_view', + 'tag' => 'OnE, TWO, and three', + 'display' => [ + 'default' => [ + 'id' => 'default', + 'display_plugin' => 'default', + 'display_title' => 'Default', + ], + ], + ); + + $storage = new View($config, 'view'); + $view = new ViewExecutable($storage, $this->user, $this->viewsData); + $display = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase') + ->disableOriginalConstructor() + ->getMock(); + $display->display = $config['display']['default']; + + $view->current_display = 'default'; + $view->display_handler = $display; + $view->displayHandlers = $this->displayCollection; + $view->displayHandlers->expects($this->any()) + ->method('get') + ->with('default') + ->willReturn($display); + $view->displayHandlers->expects($this->any()) + ->method('has') + ->with('default') + ->willReturn(TRUE); + + return array($view, $display); + } + } diff --git a/core/modules/views/tests/src/Unit/ViewsHandlerManagerTest.php b/core/modules/views/tests/src/Unit/ViewsHandlerManagerTest.php index eba45daf2c6d..614aa299d95e 100644 --- a/core/modules/views/tests/src/Unit/ViewsHandlerManagerTest.php +++ b/core/modules/views/tests/src/Unit/ViewsHandlerManagerTest.php @@ -29,16 +29,42 @@ class ViewsHandlerManagerTest extends UnitTestCase { */ protected $moduleHandler; + /** + * The mocked views data. + * + * @var \Drupal\views\ViewsData|\PHPUnit_Framework_MockObject_MockObject + */ + protected $viewsData; + + /** + * The mocked factory. + * + * @var \Drupal\Component\Plugin\Factory\FactoryInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $factory; + /** * {@inheritdoc} */ public function setUp() { - $views_data = $this->getMockBuilder('Drupal\views\ViewsData') + $this->viewsData = $this->getMockBuilder('Drupal\views\ViewsData') ->disableOriginalConstructor() ->getMock(); $cache_backend = $this->getMock('Drupal\Core\Cache\CacheBackendInterface'); $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface'); - $this->handlerManager = new ViewsHandlerManager('test', new \ArrayObject(array()), $views_data, $cache_backend, $this->moduleHandler); + $this->handlerManager = new ViewsHandlerManager('test', new \ArrayObject(array()), $this->viewsData, $cache_backend, $this->moduleHandler); + } + + /** + * Setups of the plugin factory. + */ + protected function setupMockedFactory() { + $this->factory = $this->getMock('Drupal\Component\Plugin\Factory\FactoryInterface'); + + $reflection = new \ReflectionClass($this->handlerManager); + $property = $reflection->getProperty('factory'); + $property->setAccessible(TRUE); + $property->setValue($this->handlerManager, $this->factory); } /** @@ -55,4 +81,103 @@ class ViewsHandlerManagerTest extends UnitTestCase { $this->handlerManager->getDefinitions(); } + /** + * Tests getHandler() and its base information propagation. + */ + public function testGetHandlerBaseInformationPropagation() { + $this->setupMockedFactory(); + + $item = []; + $item['table'] = 'test_table'; + $item['field'] = 'test_field'; + + $views_data = []; + $views_data['test_field']['test']['id'] = 'test_id'; + $views_data['test_field']['test']['more_information'] = 'test_id'; + $views_data['test_field']['group'] = 'test_group'; + $views_data['test_field']['title'] = 'test title'; + $views_data['test_field']['real field'] = 'test real field'; + $views_data['test_field']['real table'] = 'test real table'; + $views_data['test_field']['entity field'] = 'test entity field'; + + $this->viewsData->expects($this->once()) + ->method('get') + ->with('test_table') + ->willReturn($views_data); + + $expected_definition = [ + 'id' => 'test_id', + 'more_information' => 'test_id', + 'group' => 'test_group', + 'title' => 'test title', + 'real field' => 'test real field', + 'real table' => 'test real table', + 'entity field' => 'test entity field', + ]; + $plugin = $this->getMock('Drupal\views\Plugin\views\ViewsHandlerInterface'); + $this->factory->expects($this->once()) + ->method('createInstance') + ->with('test_id', $expected_definition) + ->willReturn($plugin); + + $result = $this->handlerManager->getHandler($item); + $this->assertSame($plugin, $result); + } + + /** + * Tests getHandler() with an override. + */ + public function testGetHandlerOverride() { + $this->setupMockedFactory(); + + $item = []; + $item['table'] = 'test_table'; + $item['field'] = 'test_field'; + + $views_data = []; + $views_data['test_field']['test']['id'] = 'test_id'; + + $this->viewsData->expects($this->once()) + ->method('get') + ->with('test_table') + ->willReturn($views_data); + + $plugin = $this->getMock('Drupal\views\Plugin\views\ViewsHandlerInterface'); + $this->factory->expects($this->once()) + ->method('createInstance') + ->with('test_override') + ->willReturn($plugin); + + $result = $this->handlerManager->getHandler($item, 'test_override'); + $this->assertSame($plugin, $result); + } + + /** + * Tests getHandler() without an override. + */ + public function testGetHandlerNoOverride() { + $this->setupMockedFactory(); + + $item = []; + $item['table'] = 'test_table'; + $item['field'] = 'test_field'; + + $views_data = []; + $views_data['test_field']['test']['id'] = 'test_id'; + + $this->viewsData->expects($this->once()) + ->method('get') + ->with('test_table') + ->willReturn($views_data); + + $plugin = $this->getMock('Drupal\views\Plugin\views\ViewsHandlerInterface'); + $this->factory->expects($this->once()) + ->method('createInstance') + ->with('test_id') + ->willReturn($plugin); + + $result = $this->handlerManager->getHandler($item); + $this->assertSame($plugin, $result); + } + } diff --git a/core/modules/views/tests/src/Unit/ViewsTest.php b/core/modules/views/tests/src/Unit/ViewsTest.php index 20db207ebc90..ab9bdf8c9ae4 100644 --- a/core/modules/views/tests/src/Unit/ViewsTest.php +++ b/core/modules/views/tests/src/Unit/ViewsTest.php @@ -31,7 +31,10 @@ class ViewsTest extends UnitTestCase { $user = $this->getMock('Drupal\Core\Session\AccountInterface'); $request_stack = new RequestStack(); $request_stack->push(new Request()); - $container->set('views.executable', new ViewExecutableFactory($user, $request_stack)); + $views_data = $this->getMockBuilder('Drupal\views\ViewsData') + ->disableOriginalConstructor() + ->getMock(); + $container->set('views.executable', new ViewExecutableFactory($user, $request_stack, $views_data)); $this->view = new View(array('id' => 'test_view'), 'view'); diff --git a/core/modules/views/views.services.yml b/core/modules/views/views.services.yml index 343e0b329faf..9654432f3a20 100644 --- a/core/modules/views/views.services.yml +++ b/core/modules/views/views.services.yml @@ -64,7 +64,7 @@ services: arguments: ['@views.views_data'] views.executable: class: Drupal\views\ViewExecutableFactory - arguments: ['@current_user', '@request_stack'] + arguments: ['@current_user', '@request_stack', '@views.views_data'] views.analyzer: class: Drupal\views\Analyzer arguments: ['@module_handler'] 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 d74bef3a06fc..342917bcb06f 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 @@ -113,6 +113,8 @@ display: hide_alter_empty: true link_to_node: true plugin_id: node + entity_type: node + entity_field: title title_1: id: title_1 table: node_field_data @@ -163,6 +165,8 @@ display: hide_alter_empty: true link_to_node: true plugin_id: node + entity_type: node + entity_field: title filters: { } sorts: { } header: diff --git a/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php b/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php index bcc03ff2f3bb..c04c32e5152b 100644 --- a/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php +++ b/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php @@ -121,7 +121,10 @@ class ViewListBuilderTest extends UnitTestCase { $user = $this->getMock('Drupal\Core\Session\AccountInterface'); $request_stack = new RequestStack(); $request_stack->push(new Request()); - $executable_factory = new ViewExecutableFactory($user, $request_stack); + $views_data = $this->getMockBuilder('Drupal\views\ViewsData') + ->disableOriginalConstructor() + ->getMock(); + $executable_factory = new ViewExecutableFactory($user, $request_stack, $views_data); $container->set('views.executable', $executable_factory); $container->set('plugin.manager.views.display', $display_manager); \Drupal::setContainer($container);