Mercurial > hg > isophonics-drupal-site
comparison core/lib/Drupal/Core/Plugin/PluginManagerPass.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
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 } |