You are here

final class PreprocessEventPass in Hook Event Dispatcher 3.x

Same name and namespace in other branches
  1. 8.2 modules/preprocess_event_dispatcher/src/Service/PreprocessEventPass.php \Drupal\preprocess_event_dispatcher\Service\PreprocessEventPass

Class PreprocessEventPass.

Hierarchy

  • class \Drupal\preprocess_event_dispatcher\Service\PreprocessEventPass implements \Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface

Expanded class hierarchy of PreprocessEventPass

2 files declare their use of PreprocessEventPass
PreprocessEventDispatcherServiceProvider.php in modules/preprocess_event_dispatcher/src/PreprocessEventDispatcherServiceProvider.php
PreprocessEventPassTest.php in modules/preprocess_event_dispatcher/tests/src/Unit/PreprocessEventPassTest.php

File

modules/preprocess_event_dispatcher/src/Service/PreprocessEventPass.php, line 13

Namespace

Drupal\preprocess_event_dispatcher\Service
View 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) : void {
    $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

Namesort descending Modifiers Type Description Overrides
PreprocessEventPass::process public function Add the PreprocessEventFactories to the PreprocessEventFactoryMapper.