Config entities implementing EntityWithPluginCollectionInterface should ask the plugins to react when their dependencies are removed

Created on 3 October 2015, over 8 years ago
Updated 14 November 2023, 8 months ago

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

  1. Add code in ConfigEntityBase::onDependencyRemoval() that tests if the entity implements EntityWithPluginCollectionInterface. 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.
  2. Add a new method onDependencyRemoval() in \Drupal\Component\Plugin\DependentPluginInterface.
  3. Add empty onDependencyRemoval() implementations in base classes implementing DependentPluginInterface with a simple return FALSE;.
  4. Implement one use-case.
  5. 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.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
Configuration entityΒ  β†’

Last updated about 14 hours ago

Created by

πŸ‡·πŸ‡΄Romania claudiu.cristea Arad πŸ‡·πŸ‡΄

Live updates comments and jobs are added and updated live.
  • API change

    Changes an existing API or subsystem. Not backportable to earlier major versions, unless absolutely required to fix a critical bug.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024