Chris@0: controllerResolver = $controller_resolver; Chris@0: $this->argumentsResolverFactory = $arguments_resolver_factory; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Checks access for the account and route using the custom access checker. Chris@0: * Chris@0: * @param \Symfony\Component\Routing\Route $route Chris@0: * The route. Chris@0: * @param \Drupal\Core\Routing\RouteMatchInterface $route_match Chris@0: * The route match object to be checked. Chris@0: * @param \Drupal\Core\Session\AccountInterface $account Chris@0: * The account being checked. Chris@0: * Chris@0: * @return \Drupal\Core\Access\AccessResultInterface Chris@0: * The access result. Chris@0: */ Chris@0: public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account) { Chris@17: try { Chris@17: $callable = $this->controllerResolver->getControllerFromDefinition($route->getRequirement('_custom_access')); Chris@17: } Chris@17: catch (\InvalidArgumentException $e) { Chris@17: // The custom access controller method was not found. Chris@17: throw new \BadMethodCallException(sprintf('The "%s" method is not callable as a _custom_access callback in route "%s"', $route->getRequirement('_custom_access'), $route->getPath())); Chris@17: } Chris@17: Chris@0: $arguments_resolver = $this->argumentsResolverFactory->getArgumentsResolver($route_match, $account); Chris@0: $arguments = $arguments_resolver->getArguments($callable); Chris@0: Chris@0: return call_user_func_array($callable, $arguments); Chris@0: } Chris@0: Chris@0: }