class RegisterPathProcessorsPass

Adds services to the 'path_processor_manager service.

Hierarchy

Expanded class hierarchy of RegisterPathProcessorsPass

1 file declares its use of RegisterPathProcessorsPass
CoreBundle.php in drupal/core/lib/Drupal/Core/CoreBundle.php
Definition of Drupal\Core\CoreBundle.

File

drupal/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterPathProcessorsPass.php, line 17
Contains \Drupal\Core\DependencyInjection\Compiler\RegisterPathProcessorsPass.

Namespace

Drupal\Core\DependencyInjection\Compiler
View source
class RegisterPathProcessorsPass implements CompilerPassInterface {

  /**
   * Adds services tagged 'path_processor_inbound' to the path processor manager.
   *
   * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
   *  The container to process.
   */
  public function process(ContainerBuilder $container) {
    if (!$container
      ->hasDefinition('path_processor_manager')) {
      return;
    }
    $manager = $container
      ->getDefinition('path_processor_manager');

    // Add inbound path processors.
    foreach ($container
      ->findTaggedServiceIds('path_processor_inbound') as $id => $attributes) {
      $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
      $manager
        ->addMethodCall('addInbound', array(
        new Reference($id),
        $priority,
      ));
    }

    // Add outbound path processors.
    foreach ($container
      ->findTaggedServiceIds('path_processor_outbound') as $id => $attributes) {
      $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
      $manager
        ->addMethodCall('addOutbound', array(
        new Reference($id),
        $priority,
      ));
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RegisterPathProcessorsPass::process public function Adds services tagged 'path_processor_inbound' to the path processor manager. Overrides CompilerPassInterface::process