function ModifyServiceDefinitionsPass::process
Same name in other branches
- 9 core/lib/Drupal/Core/DependencyInjection/Compiler/ModifyServiceDefinitionsPass.php \Drupal\Core\DependencyInjection\Compiler\ModifyServiceDefinitionsPass::process()
- 10 core/lib/Drupal/Core/DependencyInjection/Compiler/ModifyServiceDefinitionsPass.php \Drupal\Core\DependencyInjection\Compiler\ModifyServiceDefinitionsPass::process()
- 11.x core/lib/Drupal/Core/DependencyInjection/Compiler/ModifyServiceDefinitionsPass.php \Drupal\Core\DependencyInjection\Compiler\ModifyServiceDefinitionsPass::process()
File
-
core/
lib/ Drupal/ Core/ DependencyInjection/ Compiler/ ModifyServiceDefinitionsPass.php, line 18
Class
- ModifyServiceDefinitionsPass
- Passes the container to the alter() method of all service providers.
Namespace
Drupal\Core\DependencyInjection\CompilerCode
public function process(ContainerBuilder $container) {
if (!$container->has('kernel')) {
return;
}
$kernel = $container->get('kernel');
if (!$kernel instanceof DrupalKernelInterface) {
return;
}
$providers = $kernel->getServiceProviders('app');
foreach ($providers as $provider) {
if ($provider instanceof ServiceModifierInterface) {
$provider->alter($container);
}
}
$providers = $kernel->getServiceProviders('site');
foreach ($providers as $provider) {
if ($provider instanceof ServiceModifierInterface) {
$provider->alter($container);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.