You are here

class PluginManagerPass in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Plugin/PluginManagerPass.php \Drupal\Core\Plugin\PluginManagerPass

Registers plugin managers to the plugin.cache_clearer service.

Hierarchy

Expanded class hierarchy of PluginManagerPass

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

File

core/lib/Drupal/Core/Plugin/PluginManagerPass.php, line 17
Contains \Drupal\Core\Plugin\PluginManagerPass.

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 (strpos($service_id, 'plugin.manager.') === 0 || $definition
        ->hasTag('plugin_manager_cache_clear')) {
        if (is_subclass_of($definition
          ->getClass(), '\\Drupal\\Component\\Plugin\\Discovery\\CachedDiscoveryInterface')) {
          $cache_clearer_definition
            ->addMethodCall('addCachedDiscovery', array(
            new Reference($service_id),
          ));
        }
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PluginManagerPass::process public function You can modify the container here before it is dumped to PHP code. Overrides CompilerPassInterface::process