diff --git a/core/modules/views/lib/Drupal/views/Entity/View.php b/core/modules/views/lib/Drupal/views/Entity/View.php index 33a4e9c..b34ce9e 100644 --- a/core/modules/views/lib/Drupal/views/Entity/View.php +++ b/core/modules/views/lib/Drupal/views/Entity/View.php @@ -13,7 +13,6 @@ use Drupal\views\Views; use Drupal\views_ui\ViewUI; use Drupal\views\ViewStorageInterface; -use Drupal\views\ViewExecutable; /** * Defines a View configuration entity class. @@ -274,18 +273,18 @@ public function calculateDependencies() { // Ensure that the view is dependant on the module that implements the view. $this->addDependency('module', $this->module); - // Ensure that the view is dependant on the module that provides the schema + // Ensure that the view is dependent on the module that provides the schema // for the base table. $schema = $this->drupalGetSchema($this->base_table); if ($this->module != $schema['module']) { $this->addDependency('module', $schema['module']); } - $plugin_types = ViewExecutable::getPluginTypes(); $handler_types = array(); - foreach (ViewExecutable::getHandlerTypes() as $type) { + foreach (Views::getHandlerTypes() as $type) { $handler_types[] = $type['plural']; } + foreach ($this->get('display') as $display) { // Collect all dependencies of all handlers. foreach ($handler_types as $handler_type) { @@ -304,12 +303,13 @@ public function calculateDependencies() { } // Collect all dependencies of plugins. - foreach ($plugin_types as $plugin_type) { - if (isset($display['display_options'][$plugin_type]['options']['dependencies'])) { + foreach (Views::getPluginTypes('plugin') as $plugin_type) { + if (!empty($display['display_options'][$plugin_type]['options']['dependencies'])) { $this->addDependencies($display['display_options'][$plugin_type]['options']['dependencies']); } } } + return $this->dependencies; } diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php index 6196fc3..aae8e27 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php @@ -152,6 +152,7 @@ protected function defineOptions() { $options['relationship'] = array('default' => 'none'); $options['group_type'] = array('default' => 'group'); $options['admin_label'] = array('default' => '', 'translatable' => TRUE); + $options['dependencies'] = array('default' => array()); return $options; } diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php index 1c15e4f..51b1fdd 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php @@ -761,6 +761,7 @@ protected function defaultDisplayOptions() { foreach ($display_options as &$options) { $options['options'] = array(); $options['provider'] = 'views'; + $options['dependencies'] = array(); } // Add a least one field so the view validates and the user has a preview. diff --git a/core/modules/views/tests/Drupal/views/Tests/Entity/ViewTest.php b/core/modules/views/tests/Drupal/views/Tests/Entity/ViewTest.php index 81aebfb..5dd480e 100644 --- a/core/modules/views/tests/Drupal/views/Tests/Entity/ViewTest.php +++ b/core/modules/views/tests/Drupal/views/Tests/Entity/ViewTest.php @@ -23,6 +23,17 @@ class ViewTest extends UnitTestCase { /** * {@inheritdoc} */ + public static function getInfo() { + return array( + 'name' => 'View entity test', + 'description' => 'Tests the \Drupal\views\Entity\View class.', + 'group' => 'Views', + ); + } + + /** + * {@inheritdoc} + */ protected function setUp() { // Setup the entity manager. diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigHandler.php b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigHandler.php index 19241d4..52981e9 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigHandler.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigHandler.php @@ -243,7 +243,7 @@ public function submitForm(array &$form, array &$form_state) { if ($dependencies = $handler->getDependencies()) { $handler->options['dependencies'] = $dependencies; } - // Add the module providing the handler as dependency as well. + // Add the module providing the handler as a dependency as well. $handler->options['dependencies'][] = $handler->definition['provider']; // Store the item back on the view