"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.10/core/lib/Drupal/Core/Plugin/PluginManagerPass.php" (26 Nov 2020, 970 Bytes) of package /linux/www/drupal-8.9.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "PluginManagerPass.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 
    3 namespace Drupal\Core\Plugin;
    4 
    5 use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
    6 use Symfony\Component\DependencyInjection\ContainerBuilder;
    7 use Symfony\Component\DependencyInjection\Reference;
    8 
    9 /**
   10  * Registers plugin managers to the plugin.cache_clearer service.
   11  */
   12 class PluginManagerPass implements CompilerPassInterface {
   13 
   14   /**
   15    * {@inheritdoc}
   16    */
   17   public function process(ContainerBuilder $container) {
   18     $cache_clearer_definition = $container->getDefinition('plugin.cache_clearer');
   19     foreach ($container->getDefinitions() as $service_id => $definition) {
   20       if (strpos($service_id, 'plugin.manager.') === 0 || $definition->hasTag('plugin_manager_cache_clear')) {
   21         if (is_subclass_of($definition->getClass(), '\Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface')) {
   22           $cache_clearer_definition->addMethodCall('addCachedDiscovery', [new Reference($service_id)]);
   23         }
   24       }
   25     }
   26   }
   27 
   28 }