3 namespace Drupal\Core\DependencyInjection\Compiler;
5 use Symfony\Component\DependencyInjection\ContainerBuilder;
6 use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
9 * Adds the context provider service IDs to the context manager.
11 class ContextProvidersPass implements CompilerPassInterface {
16 * Passes the service IDs of all context providers to the context repository.
18 public function process(ContainerBuilder $container) {
19 $context_providers = [];
20 foreach (array_keys($container->findTaggedServiceIds('context_provider')) as $id) {
21 $context_providers[] = $id;
24 $definition = $container->getDefinition('context.repository');
25 $definition->addArgument($context_providers);