diff -u b/core/modules/views/src/Entity/View.php b/core/modules/views/src/Entity/View.php --- b/core/modules/views/src/Entity/View.php +++ b/core/modules/views/src/Entity/View.php @@ -273,11 +273,6 @@ // Ensure that the view is dependant on the module that implements the view. $this->addDependency('module', $this->module); - // For disabled views don't add any handler specific dependencies. - if (!$this->status()) { - return $this; - } - $executable = $this->getExecutable(); $executable->initDisplay(); $executable->initStyle(); @@ -510,9 +505,8 @@ if ($handler instanceof DependentWithRemovalPluginInterface) { if ($handler->onDependencyRemoval($dependencies)) { // Remove the handler and indicate we made changes and maybe don't - // need to disable this View. + // need to delete this View. unset($this->display[$display_id]['display_options'][$handler_types[$handler_type]['plural']][$handler_id]); - $disable = FALSE; $changed = TRUE; } } @@ -520,40 +514,15 @@ } } - // Check if the handlers have resolved all removed dependencies. + // If we made changes make sure the new dependencies are calculated. if ($changed) { - // Force the displays to be reinitialised to use the changed settings. $this->getExecutable()->current_display = NULL; $this->calculateDependencies(); - $new_dependencies = $this->getDependencies(); - foreach ($dependencies as $group => $dependency_list) { - foreach ($dependency_list as $config_key) { - if (isset($new_dependencies[$group]) && array_key_exists($config_key, $new_dependencies[$group])) { - // If any of the dependencies still exist in the new dependencies we - // will disable the view. - $disable = TRUE; - break 2; - } - } - } - } - // Disable the View if we made no changes or the handlers were not able to - // remove the dependencies. This will cause all handler dependencies to be - // ignored on dependency calculation. - // @todo https://www.drupal.org/node/2832558 Give better feedback for - // disabled config. - if ($disable) { - $this->disable(); - $arguments = [ - '@id' => $this->id(), - ]; - $this->getLogger()->warning("View '@id': View was disabled because its settings depend on removed dependencies.", $arguments); - $changed = TRUE; + $this->getExecutable()->setDisplay($current_display); } - $this->getExecutable()->setDisplay($current_display); - return $disable || $changed; + return $changed; } /** diff -u b/core/modules/views/tests/src/Kernel/ViewsConfigDependenciesIntegrationTest.php b/core/modules/views/tests/src/Kernel/ViewsConfigDependenciesIntegrationTest.php --- b/core/modules/views/tests/src/Kernel/ViewsConfigDependenciesIntegrationTest.php +++ b/core/modules/views/tests/src/Kernel/ViewsConfigDependenciesIntegrationTest.php @@ -92,9 +92,9 @@ } /** - * Tests removing a config dependency that disables the View. + * Tests removing a config dependency that deletes the View. */ - public function testConfigRemovalDisable() { + public function testConfigRemovalRole() { // Create a role we can add to the View and delete. $role = Role::create(array( 'id' => 'dummy', @@ -127,17 +127,14 @@ $view = View::load('entity_test_fields'); - // Checks that the view has not been deleted too. - $this->assertNotNull($view); - - // Checks that the view has been disabled. - $this->assertFalse($view->status()); + // Checks that the view has been deleted too. + $this->assertNull($view); } /** - * Tests removing a config dependency that deletes the View. + * Tests uninstalling a module providing a Views base table. */ - public function testConfigRemovalDelete() { + public function testConfigRemovalBasetable() { // Find all the entity types provided by the entity_test module and install // the schema for them so we can uninstall them. $entities = \Drupal::entityTypeManager()->getDefinitions();