final class PreprocessEventPass in Hook Event Dispatcher 8
Class PreprocessEventPass.
Hierarchy
- class \Drupal\hook_event_dispatcher\Service\PreprocessEventPass implements \Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface
Expanded class hierarchy of PreprocessEventPass
2 files declare their use of PreprocessEventPass
- HookEventDispatcherServiceProvider.php in src/
HookEventDispatcherServiceProvider.php - PreprocessEventPassTest.php in tests/
src/ Unit/ Preprocess/ PreprocessEventPassTest.php
File
- src/
Service/ PreprocessEventPass.php, line 12
Namespace
Drupal\hook_event_dispatcher\ServiceView source
final class PreprocessEventPass implements CompilerPassInterface {
/**
* Add the PreprocessEventFactories to the PreprocessEventFactoryMapper.
*
* First get the factory defaults and then append the new/overrides to them.
*
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
* Drupal container.
*/
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),
]);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PreprocessEventPass:: |
public | function | Add the PreprocessEventFactories to the PreprocessEventFactoryMapper. |