ContextProvidersPass.php in Drupal 9
File
core/lib/Drupal/Core/DependencyInjection/Compiler/ContextProvidersPass.php
View source
<?php
namespace Drupal\Core\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
class ContextProvidersPass implements CompilerPassInterface {
public function process(ContainerBuilder $container) {
$context_providers = [];
foreach (array_keys($container
->findTaggedServiceIds('context_provider')) as $id) {
$context_providers[] = $id;
}
$definition = $container
->getDefinition('context.repository');
$definition
->addArgument($context_providers);
}
}