public function RegisterAccessChecksPass::process

Implements CompilerPassInterface::process().

Adds services tagged 'access_check' to the access_manager service.

Overrides CompilerPassInterface::process

File

drupal/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterAccessChecksPass.php, line 23
Contains Drupal\Core\DependencyInjection\Compiler\RegisterAccessChecksPass.

Class

RegisterAccessChecksPass
Adds services tagged 'access_check' to the access_manager service.

Namespace

Drupal\Core\DependencyInjection\Compiler

Code

public function process(ContainerBuilder $container) {
  if (!$container
    ->hasDefinition('access_manager')) {
    return;
  }
  $access_manager = $container
    ->getDefinition('access_manager');
  foreach ($container
    ->findTaggedServiceIds('access_check') as $id => $attributes) {
    $access_manager
      ->addMethodCall('addCheckService', array(
      $id,
    ));
  }
}