From 718a47d7558078a37056aae1f7fa7a0231727f7a Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org> Date: Wed, 30 Jul 2014 13:40:49 +0100 Subject: [PATCH] =?UTF-8?q?Issue=20#2309247=20by=20G=C3=A1bor=20Hojtsy:=20?= =?UTF-8?q?Fixed=20Views=20do=20not=20depend=20on=20modules=20providing=20?= =?UTF-8?q?their=20displays.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test_views/views.view.test_view_block.yml | 4 ++++ .../test_views/views.view.test_view_block2.yml | 6 ++++++ .../comment/config/install/views.view.comments_recent.yml | 2 ++ .../config/install/views.view.test_entity_reference.yml | 4 ++++ core/modules/node/config/install/views.view.archive.yml | 3 +++ .../node/config/install/views.view.content_recent.yml | 3 +++ .../views.view.test_serializer_display_entity.yml | 4 ++++ .../test_views/views.view.test_serializer_display_field.yml | 5 +++++ .../views.view.test_serializer_node_display_field.yml | 4 ++++ core/modules/user/config/install/views.view.who_s_new.yml | 2 ++ .../modules/user/config/install/views.view.who_s_online.yml | 2 ++ core/modules/views/config/schema/views.schema.yml | 3 +++ core/modules/views/src/Entity/View.php | 5 +++++ .../test_views/views.view.test_display.yml | 4 ++++ .../test_views/views.view.test_display_invalid.yml | 4 ++++ core/modules/views/tests/src/Entity/ViewTest.php | 3 ++- 16 files changed, 57 insertions(+), 1 deletion(-) diff --git a/core/modules/block/tests/modules/block_test_views/test_views/views.view.test_view_block.yml b/core/modules/block/tests/modules/block_test_views/test_views/views.view.test_view_block.yml index ce61f44ce60b..e16db6bcf8e2 100644 --- a/core/modules/block/tests/modules/block_test_views/test_views/views.view.test_view_block.yml +++ b/core/modules/block/tests/modules/block_test_views/test_views/views.view.test_view_block.yml @@ -38,6 +38,7 @@ display: id: block_1 display_title: Block position: null + provider: block display_options: field: title: @@ -46,3 +47,6 @@ label: test_view_block module: views id: test_view_block tag: '' +dependencies: + module: + - block diff --git a/core/modules/block/tests/modules/block_test_views/test_views/views.view.test_view_block2.yml b/core/modules/block/tests/modules/block_test_views/test_views/views.view.test_view_block2.yml index 938220ef8cc3..45750f45a53e 100644 --- a/core/modules/block/tests/modules/block_test_views/test_views/views.view.test_view_block2.yml +++ b/core/modules/block/tests/modules/block_test_views/test_views/views.view.test_view_block2.yml @@ -34,6 +34,7 @@ display: provider: views_test_data title: test_view_block2 block_1: + provider: block display_plugin: block id: block_1 display_title: Block @@ -43,6 +44,7 @@ display: title: link_to_node: true block_2: + provider: block display_plugin: block id: block_2 display_title: Block @@ -52,6 +54,7 @@ display: title: link_to_node: true block_3: + provider: block display_plugin: block id: block_3 display_title: Block @@ -65,3 +68,6 @@ label: test_view_block2 module: views id: test_view_block2 tag: '' +dependencies: + module: + - block 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 f91f01a544e6..674c8a8a32c7 100644 --- a/core/modules/comment/config/install/views.view.comments_recent.yml +++ b/core/modules/comment/config/install/views.view.comments_recent.yml @@ -3,6 +3,7 @@ status: true dependencies: module: - comment + - block id: comments_recent label: 'Recent comments' module: views @@ -231,6 +232,7 @@ display: field_langcode: '***CURRENT_LANGUAGE***' field_langcode_add_to_query: null block_1: + provider: block display_plugin: block id: block_1 display_title: Block 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 2bb54bd6ef0e..46c20aca8ec6 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 @@ -9,6 +9,7 @@ display: id: entity_reference_1 display_title: EntityReference position: null + provider: entity_reference display_options: style: type: entity_reference @@ -116,3 +117,6 @@ module: entity_reference_test id: test_entity_reference tag: '' langcode: en +dependencies: + module: + - entity_reference diff --git a/core/modules/node/config/install/views.view.archive.yml b/core/modules/node/config/install/views.view.archive.yml index 7b8642973b35..e83b8e17b763 100644 --- a/core/modules/node/config/install/views.view.archive.yml +++ b/core/modules/node/config/install/views.view.archive.yml @@ -140,6 +140,7 @@ display: display_title: Block display_plugin: block position: 1 + provider: block display_options: query: type: views_query @@ -173,3 +174,5 @@ langcode: en dependencies: module: - node + - block + 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 8e231b2ca968..726628d8bfd3 100644 --- a/core/modules/node/config/install/views.view.content_recent.yml +++ b/core/modules/node/config/install/views.view.content_recent.yml @@ -460,6 +460,7 @@ display: display_options: link_url: admin/content block_category: 'Lists (Views)' + provider: block label: 'Recent content' module: node id: content_recent @@ -469,3 +470,5 @@ dependencies: module: - node - user + - block + 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 98ec07267038..687f3f2286d8 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,7 @@ display: id: rest_export_1 display_title: serializer position: null + provider: rest display_options: defaults: access: false @@ -48,3 +49,6 @@ base_field: id status: true module: rest langcode: und +dependencies: + module: + - rest diff --git a/core/modules/rest/tests/modules/rest_test_views/test_views/views.view.test_serializer_display_field.yml b/core/modules/rest/tests/modules/rest_test_views/test_views/views.view.test_serializer_display_field.yml index 33f6c9441320..9a85fb8c3c5c 100644 --- a/core/modules/rest/tests/modules/rest_test_views/test_views/views.view.test_serializer_display_field.yml +++ b/core/modules/rest/tests/modules/rest_test_views/test_views/views.view.test_serializer_display_field.yml @@ -68,6 +68,7 @@ display: id: rest_export_1 display_title: serializer position: null + provider: rest display_options: defaults: access: false @@ -85,6 +86,7 @@ display: id: rest_export_2 display_title: 'serialize - access denied' position: null + provider: rest display_options: defaults: access: false @@ -103,3 +105,6 @@ base_field: id status: true module: rest langcode: und +dependencies: + module: + - rest 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 aa44af08ee40..41c82414a6dd 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 @@ -102,6 +102,7 @@ display: id: rest_export_1 display_title: serializer position: null + provider: rest display_options: defaults: access: false @@ -118,3 +119,6 @@ base_field: nid status: true module: rest_test_views langcode: und +dependencies: + module: + - rest 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 7aa3a5d87383..0abe6e52a4a3 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 @@ -162,6 +162,7 @@ display: id: block_1 display_title: 'Who''s new' position: 1 + provider: block display_options: display_description: 'A list of new users' block_description: 'Who''s new' @@ -174,3 +175,4 @@ langcode: en dependencies: module: - user + - block 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 3b92c4936c9d..6040d381ff31 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 @@ -193,6 +193,7 @@ display: id: who_s_online_block display_title: 'Who''s online' position: 1 + provider: block display_options: block_description: 'Who''s online' display_description: 'A list of users that are currently logged in.' @@ -204,3 +205,4 @@ langcode: en dependencies: module: - user + - block diff --git a/core/modules/views/config/schema/views.schema.yml b/core/modules/views/config/schema/views.schema.yml index 8b837c2a247c..c110e44f2128 100644 --- a/core/modules/views/config/schema/views.schema.yml +++ b/core/modules/views/config/schema/views.schema.yml @@ -115,5 +115,8 @@ views.view.*: position: type: integer label: 'Position' + provider: + type: string + label: 'Display provider module' display_options: type: views.display.[%parent.display_plugin] diff --git a/core/modules/views/src/Entity/View.php b/core/modules/views/src/Entity/View.php index 93c446cc32b1..0f783ffaa374 100644 --- a/core/modules/views/src/Entity/View.php +++ b/core/modules/views/src/Entity/View.php @@ -263,6 +263,11 @@ public function calculateDependencies() { $handler_types[] = $type['plural']; } foreach ($this->get('display') as $display) { + // Add dependency for the display itself. + if (isset($display['provider'])) { + $this->addDependency('module', $display['provider']); + } + // Collect all dependencies of all handlers. foreach ($handler_types as $handler_type) { if (!empty($display['display_options'][$handler_type])) { 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 8ef177487796..840d8741726f 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 @@ -32,6 +32,7 @@ display: display_title: Block id: block_1 position: 2 + provider: block default: display_options: access: @@ -91,3 +92,6 @@ display: label: '' id: test_display tag: '' +dependencies: + module: + - block 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 fa7f52470779..638c3f58a1ae 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 @@ -30,6 +30,10 @@ display: id: block_1 display_title: Block position: 1 + provider: block label: '' id: test_display_invalid tag: '' +dependencies: + module: + - block diff --git a/core/modules/views/tests/src/Entity/ViewTest.php b/core/modules/views/tests/src/Entity/ViewTest.php index 520c6a26bc09..6bfdd5ba6ebd 100644 --- a/core/modules/views/tests/src/Entity/ViewTest.php +++ b/core/modules/views/tests/src/Entity/ViewTest.php @@ -50,6 +50,7 @@ public function testCalculateDependencies($values, $deps) { } public function calculateDependenciesProvider(){ + $handler['display']['default']['provider'] = 'block'; $handler['display']['default']['display_options']['fields']['example']['dependencies'] = array(); $handler['display']['default']['display_options']['fields']['example2']['dependencies']['module'] = array('views', 'field'); $handler['display']['default']['display_options']['fields']['example3']['dependencies']['module'] = array('views', 'image'); @@ -60,7 +61,7 @@ public function calculateDependenciesProvider(){ return array( array(array(), array('node', 'views')), - array($handler, array('field', 'image', 'node', 'views')), + array($handler, array('block', 'field', 'image', 'node', 'views')), array($plugin, array('field', 'image', 'node', 'views')), ); } -- GitLab