public function RegisterServicesForDestructionPass::process in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterServicesForDestructionPass.php \Drupal\Core\DependencyInjection\Compiler\RegisterServicesForDestructionPass::process()
- 9 core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterServicesForDestructionPass.php \Drupal\Core\DependencyInjection\Compiler\RegisterServicesForDestructionPass::process()
File
- core/
lib/ Drupal/ Core/ DependencyInjection/ Compiler/ RegisterServicesForDestructionPass.php, line 19
Class
- RegisterServicesForDestructionPass
- Adds services tagged "needs_destruction" to the "kernel_destruct_subscriber" service.
Namespace
Drupal\Core\DependencyInjection\CompilerCode
public function process(ContainerBuilder $container) {
if (!$container
->hasDefinition('kernel_destruct_subscriber')) {
return;
}
$definition = $container
->getDefinition('kernel_destruct_subscriber');
$services = $container
->findTaggedServiceIds('needs_destruction');
foreach ($services as $id => $attributes) {
$definition
->addMethodCall('registerService', [
$id,
]);
}
}