You are here

public function CustomAccessCheck::access in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Access/CustomAccessCheck.php \Drupal\Core\Access\CustomAccessCheck::access()

Checks access for the account and route using the custom access checker.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The route match object to be checked.

\Drupal\Core\Session\AccountInterface $account: The account being checked.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

File

core/lib/Drupal/Core/Access/CustomAccessCheck.php, line 66
Contains \Drupal\Core\Access\CustomAccessCheck.

Class

CustomAccessCheck
Defines an access checker that allows specifying a custom method for access.

Namespace

Drupal\Core\Access

Code

public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account) {
  $callable = $this->controllerResolver
    ->getControllerFromDefinition($route
    ->getRequirement('_custom_access'));
  $arguments_resolver = $this->argumentsResolverFactory
    ->getArgumentsResolver($route_match, $account);
  $arguments = $arguments_resolver
    ->getArguments($callable);
  return call_user_func_array($callable, $arguments);
}