public function RegisterPathProcessorsPass::process

Adds services tagged 'path_processor_inbound' to the path processor manager.

Parameters

\Symfony\Component\DependencyInjection\ContainerBuilder $container: The container to process.

Overrides CompilerPassInterface::process

File

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

Class

RegisterPathProcessorsPass
Adds services to the 'path_processor_manager service.

Namespace

Drupal\Core\DependencyInjection\Compiler

Code

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,
    ));
  }
}