Problem/Motivation
When a config entity implementing EntityWithPluginCollectionInterface
is reacting on dependency removal, it should ask the plugins from the collections if they want to take some action when their dependencies are about to be removed.
This issue is adding a generic solution for the one fixed in #2562107: EntityDisplayBase should react on removal of its components dependencies.
Proposed resolution
- Add code in
ConfigEntityBase::onDependencyRemoval()
that tests if the entity implementsEntityWithPluginCollectionInterface
. If so, iterate through collections and if there are specific plugin dependencies being removed, call the plugin::onDependencyRemoval()
method to allow the plugin to react. - Add a new method
onDependencyRemoval()
in\Drupal\Component\Plugin\DependentPluginInterface
. - Add empty
onDependencyRemoval()
implementations in base classes implementingDependentPluginInterface
with a simplereturn FALSE;
. - Implement one use-case.
- Tests.
is reacting on dependency removal, it should ask the plugins from the collections if they want to take some action when their dependencies are about to be removed.
Remaining tasks
None.
User interface changes
None.
API changes
New method \Drupal\Component\Plugin\DependentPluginInterface::onDependencyRemoval()
.
Data model changes
None.