Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / lib / Drupal / Core / DependencyInjection / Compiler / ContextProvidersPass.php
1 <?php
2
3 namespace Drupal\Core\DependencyInjection\Compiler;
4
5 use Symfony\Component\DependencyInjection\ContainerBuilder;
6 use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
8 /**
9  * Adds the context provider service IDs to the context manager.
10  */
11 class ContextProvidersPass implements CompilerPassInterface {
12
13   /**
14    * {@inheritdoc}
15    *
16    * Passes the service IDs of all context providers to the context repository.
17    */
18   public function process(ContainerBuilder $container) {
19     $context_providers = [];
20     foreach (array_keys($container->findTaggedServiceIds('context_provider')) as $id) {
21       $context_providers[] = $id;
22     }
23
24     $definition = $container->getDefinition('context.repository');
25     $definition->addArgument($context_providers);
26   }
27
28 }