8e2929b860c0a39b70ae33a690ee4c2657de6f05
[yaffs-website] / web / core / lib / Drupal / Core / DependencyInjection / Compiler / RegisterLazyRouteEnhancers.php
1 <?php
2
3 namespace Drupal\Core\DependencyInjection\Compiler;
4
5 use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6 use Symfony\Component\DependencyInjection\ContainerBuilder;
7
8 /**
9  * Registers all lazy route enhancers onto the lazy route enhancers.
10  */
11 class RegisterLazyRouteEnhancers implements CompilerPassInterface {
12
13   /**
14    * {@inheritdoc}
15    */
16   public function process(ContainerBuilder $container) {
17     if (!$container->hasDefinition('route_enhancer.lazy_collector')) {
18       return;
19     }
20
21     $service_ids = [];
22
23     foreach ($container->findTaggedServiceIds('route_enhancer') as $id => $attributes) {
24       $service_ids[$id] = $id;
25     }
26
27     $container
28       ->getDefinition('route_enhancer.lazy_collector')
29       ->addArgument($service_ids);
30   }
31
32 }