diff --git a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php index 7cfe676..768b2e5 100644 --- a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php +++ b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php @@ -428,22 +428,20 @@ public function onDependencyRemoval(array $dependencies) { } } foreach ($this->getComponents() as $name => $component) { - if (isset($component['type']) && $definition = $this->pluginManager->getDefinition($component['type'], FALSE)) { - if (in_array($definition['provider'], $dependencies['module'])) { + if ($renderer = $this->getRenderer($name)) { + if (in_array($renderer->getPluginDefinition()['provider'], $dependencies['module'])) { // Revert to the defaults if the plugin that supplies the widget or // formatter depends on a module that is being uninstalled. $this->setComponent($name); $changed = TRUE; } - // Allow components to react on dependency removals. - if ($renderer = $this->getRenderer($name)) { - if ($component_changed = $renderer->onDependencyRemoval($dependencies)) { - // Update component settings to reflect changes. - $component['settings'] = $renderer->getSettings(); - $this->setComponent($name, $component); - $changed = TRUE; - } + // Give this component the opportunity to react on dependency removal. + if ($component_changed = $renderer->onDependencyRemoval($dependencies)) { + // Update component settings to reflect changes. + $component['settings'] = $renderer->getSettings(); + $this->setComponent($name, $component); + $changed = TRUE; } } } diff --git a/core/lib/Drupal/Core/Field/PluginSettingsInterface.php b/core/lib/Drupal/Core/Field/PluginSettingsInterface.php index 5884a5e..0c31481 100644 --- a/core/lib/Drupal/Core/Field/PluginSettingsInterface.php +++ b/core/lib/Drupal/Core/Field/PluginSettingsInterface.php @@ -96,7 +96,8 @@ public function getThirdPartySetting($module, $key, $default = NULL); public function setThirdPartySetting($module, $key, $value); /** - * Provides actions when is called to react on removal of its dependencies. + * Runs update actions when this plugin is asked to react on removal of its + * dependencies. * * This method allows plugins to keep their configuration up-to-date when a * dependency calculated with ::calculateDependencies() is removed. For @@ -105,8 +106,8 @@ public function setThirdPartySetting($module, $key, $value); * this method is called by the view display to react on the dependency * removal by updating its configuration. * - * This method returns TRUE if the removal event updated the plugin - * configuration. + * This method must return TRUE if the removal event updated the plugin + * configuration or FALSE otherwise. * * @param array $dependencies * An array of dependencies that will be deleted keyed by dependency type.