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

Comments

sun’s picture

Doesn't this apply to non-derivative plugin instances, too?

What are we going to do in update.php? In case a plugin ID needs to change?

IMHO, we need a global plugin manager (the plugin manager of all plugin managers) to handle global CRUD of plugin instances and to dispatch appropriate actions to child managers and other subsystems.

xjm’s picture

Well, I believe non-derivative plugin instances only need to be ignored when the owner module is disabled (#1199946: Disabled modules are broken beyond repair so the "disable" functionality needs to be removed) or cleaned up when it is uninstalled (#1776830: [META-1] Installation and uninstallation of configuration provided by a module that belongs to another module's API), which are general problems outside the plugin system. The derivative definitions are implementation-specific, though, and depend on the owner module's API or even other modules' APIs, so either the individual modules should always have some code to handle this, or we need some systematic way of handling it for the plugin system and ConfigEntity.

xjm’s picture

Issue tags: +Block plugins
xjm’s picture

Status: Postponed » Active
xjm’s picture

Issue summary: View changes

Removing myself from the author field so that I can unfollow the issue. --xjm

Xano’s picture

dawehner’s picture

Well yeah: this issue describes the bug and the other issue provides one possible solution for it.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

tim.plunkett’s picture

Issue tags: -Blocks-Layouts

Not actively part of the Blocks-Layouts work.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.