diff --git a/core/modules/views/src/Entity/View.php b/core/modules/views/src/Entity/View.php index af77789..aff0c62 100644 --- a/core/modules/views/src/Entity/View.php +++ b/core/modules/views/src/Entity/View.php @@ -274,10 +274,13 @@ public function calculateDependencies() { // Add the additional dependencies from the handler configuration. if (!empty($handler['dependencies'])) { $this->addDependencies($handler['dependencies']); + } } } } - } + + // @todo This totally does not work for argument validator/default + // plugins. // Collect all dependencies of plugins. foreach (Views::getPluginTypes('plugin') as $plugin_type) { diff --git a/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php b/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php index 735fe57..a1475a6 100644 --- a/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php +++ b/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php @@ -23,7 +23,7 @@ class ViewEntityDependenciesTest extends ViewUnitTestBase { * * @var array */ - public static $testViews = array('test_field_get_entity', 'test_relationship_dependency'); + public static $testViews = array('test_field_get_entity', 'test_relationship_dependency', 'test_plugin_dependencies'); /** * Modules to enable. @@ -51,10 +51,19 @@ public function testCalculateDependencies() { 'node', ) ); + $expected['test_plugin_dependencies'] = array( + 'module' => array( + 'comment', + // The argument handler has an explicit depedency on views_test_data. + 'views_test_data', + ), + 'test_dependency' => array( + 'row', 'style', + ) + ); foreach ($expected as $view_id => $expected_dependencies) { $view = Views::getView($view_id); - $expected_dependencies = $dependencies = $view->calculateDependencies(); $this->assertEqual($expected_dependencies, $dependencies); } 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 09c5566..ceb2305 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 @@ -7,6 +7,19 @@ display: display_options: access: type: test_static + dependencies: + test_dependency: + - style + arguments: + 'null': + default_action: default + default_argument_type: fixed + id: 'null' + must_not_be: '0' + style_plugin: default_summary + table: views + plugin_id: 'null' + provider: views_test_data cache: type: none exposed_form: @@ -30,8 +43,14 @@ display: sorts: { } style: type: test_style + dependencies: + test_dependency: + - style row: type: test_row + dependencies: + test_dependency: + - row display_plugin: default display_title: Master id: default 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 fb685e6..c72e6ac 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 @@ -34,6 +34,9 @@ display: table: comment_field_data plugin_id: standard provider: views + dependencies: + module: + - node sorts: { } style: type: default