public function DefaultAccessCheck::access in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Access/DefaultAccessCheck.php \Drupal\Core\Access\DefaultAccessCheck::access()
- 9 core/lib/Drupal/Core/Access/DefaultAccessCheck.php \Drupal\Core\Access\DefaultAccessCheck::access()
Checks access to the route based on the _access parameter.
Parameters
\Symfony\Component\Routing\Route $route: The route to check against.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
File
- core/
lib/ Drupal/ Core/ Access/ DefaultAccessCheck.php, line 22
Class
- DefaultAccessCheck
- Allows access to routes to be controlled by an '_access' boolean parameter.
Namespace
Drupal\Core\AccessCode
public function access(Route $route) {
if ($route
->getRequirement('_access') === 'TRUE') {
return AccessResult::allowed();
}
elseif ($route
->getRequirement('_access') === 'FALSE') {
return AccessResult::forbidden();
}
else {
return AccessResult::neutral();
}
}