Change record status: 
Project: 
Introduced in branch: 
Introduced in version: 
Description: 

Services implementing CachedDiscoveryInterface are tagged automatically with plugin_manager_cache_clear through autoconfiguration.

Before, PluginManagerPass added the tag to every service with an ID starting with plugin.manager.. This automatic tagging based on the ID is deprecated in drupal:12.1.0 and will is removed from drupal:13.0.0.

  • Autoconfigured services that implement the interface without the tag are now also cleared on cache rebuild.
  • Definitions added in ServiceModifierInterface::alter() do not receive autoconfigured tags. These definitions need the tag added manually.

Before:

services:
  plugin.manager.example:
    class: Drupal\example\ExampleManager
    parent: default_plugin_manager

After, compatible with all Drupal versions:

services:
  plugin.manager.example:
    class: Drupal\example\ExampleManager
    parent: default_plugin_manager
    tags:
      - { name: plugin_manager_cache_clear }

Or with autoconfiguration:

services:
  _defaults:
    autoconfigure: true
  plugin.manager.example:
    class: Drupal\example\ExampleManager
    parent: default_plugin_manager
Impacts: 
Module developers