function ImageEffectBase::onCollectionDependencyRemoval

Informs the plugin in a collection to act on removal of dependencies.

This method allows a plugin instance in a collection to remove dependencies from their configuration. For example, if a plugin integrates with a specific module, it should remove that module from its own configuration when the module is uninstalled.

Parameters

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

Return value

\Drupal\Core\Plugin\RemovableDependentPluginReturn

  • RemovableDependentPluginReturn::Changed if the configuration of the plugin instance has changed
  • RemovableDependentPluginReturn::Remove if the plugin instance should be removed from the plugin collection
  • RemovableDependentPluginReturn::Unchanged if the configuration of the plugin instance has not changed.

Overrides RemovableDependentPluginInterface::onCollectionDependencyRemoval

File

core/modules/image/src/ImageEffectBase.php, line 164

Class

ImageEffectBase
Provides a base class for image effects.

Namespace

Drupal\image

Code

public function onCollectionDependencyRemoval(array $dependencies) : RemovableDependentPluginReturn {
  // If the module that provides the image effect plugin is uninstalled,
  // the plugin instance should be removed from the collection.
  return in_array($this->getPluginDefinition()['provider'], $dependencies['module'] ?? []) ? RemovableDependentPluginReturn::Remove : RemovableDependentPluginReturn::Unchanged;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.