comparison core/lib/Drupal/Core/Access/CustomAccessCheck.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
59 * 59 *
60 * @return \Drupal\Core\Access\AccessResultInterface 60 * @return \Drupal\Core\Access\AccessResultInterface
61 * The access result. 61 * The access result.
62 */ 62 */
63 public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account) { 63 public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account) {
64 $callable = $this->controllerResolver->getControllerFromDefinition($route->getRequirement('_custom_access')); 64 try {
65 $callable = $this->controllerResolver->getControllerFromDefinition($route->getRequirement('_custom_access'));
66 }
67 catch (\InvalidArgumentException $e) {
68 // The custom access controller method was not found.
69 throw new \BadMethodCallException(sprintf('The "%s" method is not callable as a _custom_access callback in route "%s"', $route->getRequirement('_custom_access'), $route->getPath()));
70 }
71
65 $arguments_resolver = $this->argumentsResolverFactory->getArgumentsResolver($route_match, $account); 72 $arguments_resolver = $this->argumentsResolverFactory->getArgumentsResolver($route_match, $account);
66 $arguments = $arguments_resolver->getArguments($callable); 73 $arguments = $arguments_resolver->getArguments($callable);
67 74
68 return call_user_func_array($callable, $arguments); 75 return call_user_func_array($callable, $arguments);
69 } 76 }