class PluginManagerPass

Same name in other branches
  1. 9 core/lib/Drupal/Core/Plugin/PluginManagerPass.php \Drupal\Core\Plugin\PluginManagerPass
  2. 8.9.x core/lib/Drupal/Core/Plugin/PluginManagerPass.php \Drupal\Core\Plugin\PluginManagerPass
  3. 11.x core/lib/Drupal/Core/Plugin/PluginManagerPass.php \Drupal\Core\Plugin\PluginManagerPass

Registers plugin managers to the plugin.cache_clearer service.

Hierarchy

  • class \Drupal\Core\Plugin\PluginManagerPass implements \Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface

Expanded class hierarchy of PluginManagerPass

1 file declares its use of PluginManagerPass
CoreServiceProvider.php in core/lib/Drupal/Core/CoreServiceProvider.php

File

core/lib/Drupal/Core/Plugin/PluginManagerPass.php, line 12

Namespace

Drupal\Core\Plugin
View source
class PluginManagerPass implements CompilerPassInterface {
    
    /**
     * {@inheritdoc}
     */
    public function process(ContainerBuilder $container) {
        $cache_clearer_definition = $container->getDefinition('plugin.cache_clearer');
        foreach ($container->getDefinitions() as $service_id => $definition) {
            if (str_starts_with($service_id, 'plugin.manager.') || $definition->hasTag('plugin_manager_cache_clear')) {
                if (is_subclass_of($definition->getClass(), '\\Drupal\\Component\\Plugin\\Discovery\\CachedDiscoveryInterface')) {
                    $cache_clearer_definition->addMethodCall('addCachedDiscovery', [
                        new Reference($service_id),
                    ]);
                }
            }
        }
    }

}

Members

Title Sort descending Modifiers Object type Summary
PluginManagerPass::process public function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.