class ModifyServiceDefinitionsPass in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/DependencyInjection/Compiler/ModifyServiceDefinitionsPass.php \Drupal\Core\DependencyInjection\Compiler\ModifyServiceDefinitionsPass
Passes the container to the alter() method of all service providers.
Hierarchy
- class \Drupal\Core\DependencyInjection\Compiler\ModifyServiceDefinitionsPass implements CompilerPassInterface
Expanded class hierarchy of ModifyServiceDefinitionsPass
1 file declares its use of ModifyServiceDefinitionsPass
- CoreServiceProvider.php in core/
lib/ Drupal/ Core/ CoreServiceProvider.php - Contains \Drupal\Core\CoreServiceProvider.
File
- core/
lib/ Drupal/ Core/ DependencyInjection/ Compiler/ ModifyServiceDefinitionsPass.php, line 18 - Contains \Drupal\Core\DependencyInjection\Compiler\ModifyServiceDefinitionsPass.
Namespace
Drupal\Core\DependencyInjection\CompilerView source
class ModifyServiceDefinitionsPass implements CompilerPassInterface {
/**
* {@inheritdoc}
*/
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);
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ModifyServiceDefinitionsPass:: |
public | function |
You can modify the container here before it is dumped to PHP code. Overrides CompilerPassInterface:: |