8.3.x ConfigEntityBase.php public ConfigEntityBase::onDependencyRemoval(array $dependencies)
8.0.x ConfigEntityBase.php public ConfigEntityBase::onDependencyRemoval(array $dependencies)
8.1.x ConfigEntityBase.php public ConfigEntityBase::onDependencyRemoval(array $dependencies)
8.2.x ConfigEntityBase.php public ConfigEntityBase::onDependencyRemoval(array $dependencies)
8.4.x ConfigEntityBase.php public ConfigEntityBase::onDependencyRemoval(array $dependencies)

Informs the entity that entities it depends on will be deleted.

This method allows configuration entities to remove dependencies instead of being deleted themselves. Configuration entities can use this method to avoid being unnecessarily deleted during an extension uninstallation. For example, entity displays remove references to widgets and formatters if the plugin that supplies them depends on a module that is being uninstalled.

If this method returns TRUE then the entity needs to be re-saved by the caller for the changes to take effect. Implementations should not save the entity.

Parameters

array $dependencies: An array of dependencies that will be deleted keyed by dependency type. Dependency types are, for example, entity, module and theme.

Return value

bool TRUE if the entity has been changed as a result, FALSE if not.

Overrides ConfigEntityInterface::onDependencyRemoval

See also

\Drupal\Core\Config\Entity\ConfigDependencyManager

\Drupal\Core\Config\ConfigEntityBase::preDelete()

\Drupal\Core\Config\ConfigManager::uninstall()

\Drupal\Core\Entity\EntityDisplayBase::onDependencyRemoval()

5 calls to ConfigEntityBase::onDependencyRemoval()
ConfigTest::onDependencyRemoval in core/modules/config/tests/config_test/src/Entity/ConfigTest.php
Informs the entity that entities it depends on will be deleted.
EntityDisplayBase::onDependencyRemoval in core/lib/Drupal/Core/Entity/EntityDisplayBase.php
Informs the entity that entities it depends on will be deleted.
FieldConfigBase::onDependencyRemoval in core/lib/Drupal/Core/Field/FieldConfigBase.php
Informs the entity that entities it depends on will be deleted.
FilterFormat::onDependencyRemoval in core/modules/filter/src/Entity/FilterFormat.php
Informs the entity that entities it depends on will be deleted.
RestResourceConfig::onDependencyRemoval in core/modules/rest/src/Entity/RestResourceConfig.php
Informs the entity that entities it depends on will be deleted.
5 methods override ConfigEntityBase::onDependencyRemoval()
ConfigTest::onDependencyRemoval in core/modules/config/tests/config_test/src/Entity/ConfigTest.php
Informs the entity that entities it depends on will be deleted.
EntityDisplayBase::onDependencyRemoval in core/lib/Drupal/Core/Entity/EntityDisplayBase.php
Informs the entity that entities it depends on will be deleted.
FieldConfigBase::onDependencyRemoval in core/lib/Drupal/Core/Field/FieldConfigBase.php
Informs the entity that entities it depends on will be deleted.
FilterFormat::onDependencyRemoval in core/modules/filter/src/Entity/FilterFormat.php
Informs the entity that entities it depends on will be deleted.
RestResourceConfig::onDependencyRemoval in core/modules/rest/src/Entity/RestResourceConfig.php
Informs the entity that entities it depends on will be deleted.

File

core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php, line 500

Class

ConfigEntityBase
Defines a base configuration entity class.

Namespace

Drupal\Core\Config\Entity

Code

public function onDependencyRemoval(array $dependencies) {
  $changed = FALSE;
  if (!empty($this->third_party_settings)) {
    $old_count = count($this->third_party_settings);
    $this->third_party_settings = array_diff_key($this->third_party_settings, array_flip($dependencies['module']));
    $changed = $old_count != count($this->third_party_settings);
  }
  return $changed;
}