public function PreprocessEventPass::process in Hook Event Dispatcher 8
Add the PreprocessEventFactories to the PreprocessEventFactoryMapper.
First get the factory defaults and then append the new/overrides to them.
Parameters
\Symfony\Component\DependencyInjection\ContainerBuilder $container: Drupal container.
File
- src/
Service/ PreprocessEventPass.php, line 22
Class
- PreprocessEventPass
- Class PreprocessEventPass.
Namespace
Drupal\hook_event_dispatcher\ServiceCode
public function process(ContainerBuilder $container) {
$factoryMapper = $container
->getDefinition('preprocess_event.factory_mapper');
$factoryIds = $container
->findTaggedServiceIds('preprocess_event_default_factory');
$factoryIds += $container
->findTaggedServiceIds('preprocess_event_factory');
foreach (\array_keys($factoryIds) as $id) {
$factoryMapper
->addMethodCall('addFactory', [
new Reference($id),
]);
}
}