Determine how to clean up plugin instances when the derivative definitions change

Created on 11 January 2013, almost 13 years ago
Updated 26 August 2025, about 2 months ago

Posted by xjm

Problem/Motivation

This is a followup issue for #1871696: Convert block instances to configuration entities to resolve architectural issues β†’ .

Currently, the plugin system does not offer any consistent way to respond to changes in the derivative definition list. For example, when a custom menu is deleted, any menu blocks using that menu should also be deleted.

Proposed resolution

There are two possible resolutions:

  1. Each module that provides plugins is responsible for manually deleting the instances of those plugins that depend on removed derivative definitions. So, menu adds an entity_delete_multiple('block', $ids) in menu_delete(), custom_block adds something in $block->delete(), aggregator adds something in... uhm, yuck, aggregator_admin_remove_feed_submit()...
  2. We add a systematic way for block plugins (and/or other plugins) to indicate what data should be cleaned up when, perhaps by providing a method on the derivative class, or a hook, or... something...

In either case, we need to review all the block plugins that provide derivatives and ensure that their respective modules are cleaning up their data, and that this has test coverage.

Remaining tasks

This issue is postponed on #1871696: Convert block instances to configuration entities to resolve architectural issues β†’ , which introduces some patterns for interaction between configuration entities and the plugin system.

Related issues

πŸ“Œ Task
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

plugin system

Created by

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

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.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024