diff --git a/core/modules/comment/src/Plugin/views/wizard/Comment.php b/core/modules/comment/src/Plugin/views/wizard/Comment.php index 7118dbc..54ddd7f 100644 --- a/core/modules/comment/src/Plugin/views/wizard/Comment.php +++ b/core/modules/comment/src/Plugin/views/wizard/Comment.php @@ -150,7 +150,7 @@ protected function defaultDisplayOptions() { $display_options['relationships']['node']['required'] = 1; $display_options['relationships']['node']['plugin_id'] = 'standard'; $display_options['relationships']['node']['provider'] = 'views'; - $display_options['relationships']['node']['dependencies'] = array(); + $display_options['relationships']['node']['dependencies'] = []; // Remove the default fields, since we are customizing them here. unset($display_options['fields']); @@ -160,7 +160,7 @@ protected function defaultDisplayOptions() { $display_options['fields']['subject']['table'] = 'comment_field_data'; $display_options['fields']['subject']['field'] = 'subject'; $display_options['fields']['subject']['provider'] = 'comment'; - $display_options['fields']['subject']['dependencies'] = array(); + $display_options['fields']['subject']['dependencies'] = []; $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/file/src/Plugin/views/wizard/File.php b/core/modules/file/src/Plugin/views/wizard/File.php index 068a2c1..3f8094e 100644 --- a/core/modules/file/src/Plugin/views/wizard/File.php +++ b/core/modules/file/src/Plugin/views/wizard/File.php @@ -54,7 +54,7 @@ protected function defaultDisplayOptions() { $display_options['fields']['filename']['table'] = 'file_managed'; $display_options['fields']['filename']['field'] = 'filename'; $display_options['fields']['filename']['provider'] = 'file'; - $display_options['fields']['filename']['dependencies'] = array(); + $display_options['fields']['filename']['dependencies'] = []; $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/src/Plugin/views/wizard/Node.php b/core/modules/node/src/Plugin/views/wizard/Node.php index 73f9e6c..686ea72 100644 --- a/core/modules/node/src/Plugin/views/wizard/Node.php +++ b/core/modules/node/src/Plugin/views/wizard/Node.php @@ -138,7 +138,7 @@ protected function defaultDisplayOptions() { $display_options['fields']['title']['table'] = 'node_field_data'; $display_options['fields']['title']['field'] = 'title'; $display_options['fields']['title']['provider'] = 'node'; - $display_options['fields']['title']['dependencies'] = array(); + $display_options['fields']['title']['dependencies'] = []; $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 98de6c8..bd28f8d 100644 --- a/core/modules/node/src/Plugin/views/wizard/NodeRevision.php +++ b/core/modules/node/src/Plugin/views/wizard/NodeRevision.php @@ -99,7 +99,7 @@ protected function defaultDisplayOptions() { $display_options['fields']['changed']['table'] = 'node_field_revision'; $display_options['fields']['changed']['field'] = 'changed'; $display_options['fields']['changed']['provider'] = 'node'; - $display_options['fields']['changed']['dependencies'] = array(); + $display_options['fields']['changed']['dependencies'] = []; $display_options['fields']['changed']['alter']['alter_text'] = FALSE; $display_options['fields']['changed']['alter']['make_link'] = FALSE; $display_options['fields']['changed']['alter']['absolute'] = FALSE; @@ -116,7 +116,7 @@ protected function defaultDisplayOptions() { $display_options['fields']['title']['table'] = 'node_field_revision'; $display_options['fields']['title']['field'] = 'title'; $display_options['fields']['title']['provider'] = 'node'; - $display_options['fields']['title']['dependencies'] = array(); + $display_options['fields']['title']['dependencies'] = []; $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/taxonomy/src/Plugin/views/wizard/TaxonomyTerm.php b/core/modules/taxonomy/src/Plugin/views/wizard/TaxonomyTerm.php index 8b7f4ce..bd16b39 100644 --- a/core/modules/taxonomy/src/Plugin/views/wizard/TaxonomyTerm.php +++ b/core/modules/taxonomy/src/Plugin/views/wizard/TaxonomyTerm.php @@ -52,7 +52,7 @@ protected function defaultDisplayOptions() { $display_options['fields']['name']['table'] = 'taxonomy_term_field_data'; $display_options['fields']['name']['field'] = 'name'; $display_options['fields']['name']['provider'] = 'taxonomy'; - $display_options['fields']['name']['dependencies'] = array(); + $display_options['fields']['name']['dependencies'] = []; $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/src/Plugin/views/wizard/Users.php b/core/modules/user/src/Plugin/views/wizard/Users.php index fb71218..24b71df 100644 --- a/core/modules/user/src/Plugin/views/wizard/Users.php +++ b/core/modules/user/src/Plugin/views/wizard/Users.php @@ -75,7 +75,7 @@ protected function defaultDisplayOptions() { $display_options['fields']['name']['table'] = 'users_field_data'; $display_options['fields']['name']['field'] = 'name'; $display_options['fields']['name']['provider'] = 'user'; - $display_options['fields']['name']['dependencies'] = array(); + $display_options['fields']['name']['dependencies'] = []; $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/views/src/Plugin/views/PluginBase.php b/core/modules/views/src/Plugin/views/PluginBase.php index fe7b67d..2edf4c3 100644 --- a/core/modules/views/src/Plugin/views/PluginBase.php +++ b/core/modules/views/src/Plugin/views/PluginBase.php @@ -404,9 +404,6 @@ public function getDependencies() { * - \Drupal\views\Plugin\views\PluginBase::INCLUDE_NEGOTIATED: Add * negotiated language types. * - * @todo Update this docblock to reflect the dependencies structure for module, - * entity etc.. - * * @return array * An array of language names, keyed by the language code. Negotiated and * special languages have special codes that are substituted in queries by diff --git a/core/modules/views/src/Plugin/views/ViewsPluginInterface.php b/core/modules/views/src/Plugin/views/ViewsPluginInterface.php index df5de7a..e44d88a 100644 --- a/core/modules/views/src/Plugin/views/ViewsPluginInterface.php +++ b/core/modules/views/src/Plugin/views/ViewsPluginInterface.php @@ -20,10 +20,10 @@ interface ViewsPluginInterface extends PluginInspectionInterface, DerivativeInspectionInterface { /** - * Returns an array of module dependencies for this plugin. + * Returns an array of dependencies for this plugin. * - * Dependencies are a list of module names, which might depend on the - * configuration. + * Dependencies are keyed by the type of dependency. 'module', 'entity' and + * 'config' are common dependency types for it. * * @return array */ diff --git a/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php b/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php index a30a84b..e2e930a 100644 --- a/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php +++ b/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php @@ -23,45 +23,45 @@ class ViewEntityDependenciesTest extends ViewUnitTestBase { * * @var array */ - public static $testViews = array('test_field_get_entity', 'test_relationship_dependency', 'test_plugin_dependencies'); + public static $testViews = ['test_field_get_entity', 'test_relationship_dependency', 'test_plugin_dependencies']; /** * Modules to enable. * * @var array */ - public static $modules = array('node', 'comment', 'user', 'field'); + public static $modules = ['node', 'comment', 'user', 'field']; /** * Tests the calculateDependencies method. */ public function testCalculateDependencies() { - $expected = array(); - $expected['test_field_get_entity'] = array( - 'module' => array( + $expected = []; + $expected['test_field_get_entity'] = [ + 'module' => [ 'comment', 'node', 'user', - ) - ); + ] + ]; // Tests dependencies of relationships. - $expected['test_relationship_dependency'] = array( - 'module' => array( + $expected['test_relationship_dependency'] = [ + 'module' => [ 'comment', 'node', - ) - ); - $expected['test_plugin_dependencies'] = array( - 'module' => array( + ] + ]; + $expected['test_plugin_dependencies'] = [ + 'module' => [ 'comment', // The argument handler has an explicit dependency on views_test_data. 'views_test_data', - ), - 'test_dependency' => array( + ], + 'test_dependency' => [ 'row', 'style', - ) - ); + ] + ]; foreach ($expected as $view_id => $expected_dependencies) { $view = Views::getView($view_id); diff --git a/core/modules/views/src/ViewExecutable.php b/core/modules/views/src/ViewExecutable.php index afd4053..1d4ea10 100644 --- a/core/modules/views/src/ViewExecutable.php +++ b/core/modules/views/src/ViewExecutable.php @@ -297,7 +297,7 @@ class ViewExecutable { * * @var array */ - public $relationship = array(); + public $relationship = []; /** * Stores the area handlers for the header which are initialized on this view. diff --git a/core/modules/views/src/ViewsData.php b/core/modules/views/src/ViewsData.php index 814bd89..d76616e 100644 --- a/core/modules/views/src/ViewsData.php +++ b/core/modules/views/src/ViewsData.php @@ -232,7 +232,7 @@ protected function getData() { } else { $modules = $this->moduleHandler->getImplementations('views_data'); - $data = array(); + $data = []; foreach ($modules as $module) { $views_data = $this->moduleHandler->invoke($module, 'views_data'); diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/access/StaticTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/access/StaticTest.php index 5ca4867..503787c 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/access/StaticTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/access/StaticTest.php @@ -46,9 +46,9 @@ public function alterRouteDefinition(Route $route) { * {@inheritdoc} */ public function getDependencies() { - return array( - 'test_dependency' => array('access'), - ); + return [ + 'test_dependency' => ['access'], + ]; } } diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/argument_default/ArgumentDefaultTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/argument_default/ArgumentDefaultTest.php index 36047bd..a3487f2 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/argument_default/ArgumentDefaultTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/argument_default/ArgumentDefaultTest.php @@ -40,9 +40,9 @@ public function getArgument() { * {@inheritdoc} */ public function getDependencies() { - return array( - 'test_dependency' => array('argument_default'), - ); + return [ + 'test_dependency' => ['argument_default'], + ]; } } diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php index a0ceec2..9ff43ea 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php @@ -144,9 +144,9 @@ public function preview() { * {@inheritdoc} */ public function getDependencies() { - return parent::getDependencies() + array( - 'test_dependency' => array('display'), - ); + return parent::getDependencies() + [ + 'test_dependency' => ['display'], + ]; } } diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php index eb3c686..efd5f55 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php @@ -150,9 +150,9 @@ public function match($element, $condition) { * {@inheritdoc} */ public function getDependencies() { - return parent::getDependencies() + array( - 'test_dependency' => array('query'), - ); + return parent::getDependencies() + [ + 'test_dependency' => ['query'], + ]; } } diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/row/RowTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/row/RowTest.php index a80561d..da4122a 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/row/RowTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/row/RowTest.php @@ -86,9 +86,9 @@ public function render($row) { * {@inheritdoc} */ public function getDependencies() { - return array( - 'test_dependency' => array('row'), - ); + return [ + 'test_dependency' => ['row'], + ]; } } diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/StyleTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/StyleTest.php index 5af3c44..e1c64b9 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/StyleTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/StyleTest.php @@ -115,9 +115,9 @@ public function render() { * {@inheritdoc} */ public function getDependencies() { - return array( - 'test_dependency' => array('style'), - ); + return [ + 'test_dependency' => ['style'], + ]; } } diff --git a/core/modules/views/tests/src/Unit/Entity/ViewTest.php b/core/modules/views/tests/src/Unit/Entity/ViewTest.php index d7b6708..ecd01f3 100644 --- a/core/modules/views/tests/src/Unit/Entity/ViewTest.php +++ b/core/modules/views/tests/src/Unit/Entity/ViewTest.php @@ -47,25 +47,25 @@ protected function setUp() { public function testCalculateDependencies($values, $deps) { $view = new TestView($values, 'view'); $views_deps = $view->calculateDependencies(); - $this->assertEquals(array('module' => $deps), $views_deps); + $this->assertEquals(['module' => $deps], $views_deps); } /** * Data provider for testCalculateDependencies. */ public function calculateDependenciesProvider(){ - $handler = array(); + $handler = []; $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'); - $handler['display']['default']['display_options']['query']['dependencies']['module'] = array('node'); + $handler['display']['default']['display_options']['fields']['example']['dependencies'] = []; + $handler['display']['default']['display_options']['fields']['example2']['dependencies']['module'] = ['views', 'field']; + $handler['display']['default']['display_options']['fields']['example3']['dependencies']['module'] = ['views', 'image']; + $handler['display']['default']['display_options']['query']['dependencies']['module'] = ['node']; - $plugin = array(); - $plugin['display']['default']['display_options']['access']['dependencies'] = array(); - $plugin['display']['default']['display_options']['row']['dependencies']['module'] = array('views', 'field'); - $plugin['display']['default']['display_options']['style']['dependencies']['module'] = array('views', 'image'); - $plugin['display']['default']['display_options']['query']['dependencies']['module'] = array('node'); + $plugin = []; + $plugin['display']['default']['display_options']['access']['dependencies'] = []; + $plugin['display']['default']['display_options']['row']['dependencies']['module'] = ['views', 'field']; + $plugin['display']['default']['display_options']['style']['dependencies']['module'] = ['views', 'image']; + $plugin['display']['default']['display_options']['query']['dependencies']['module'] = ['node']; return array( array(array(), array('views')),