class DefaultAccessCheck
Same name in other branches
- 9 core/lib/Drupal/Core/Access/DefaultAccessCheck.php \Drupal\Core\Access\DefaultAccessCheck
- 8.9.x core/lib/Drupal/Core/Access/DefaultAccessCheck.php \Drupal\Core\Access\DefaultAccessCheck
- 10 core/lib/Drupal/Core/Access/DefaultAccessCheck.php \Drupal\Core\Access\DefaultAccessCheck
Allows access to routes to be controlled by an '_access' boolean parameter.
Hierarchy
- class \Drupal\Core\Access\DefaultAccessCheck implements \Drupal\Core\Routing\Access\AccessInterface
Expanded class hierarchy of DefaultAccessCheck
2 files declare their use of DefaultAccessCheck
- AccessManagerTest.php in core/
tests/ Drupal/ Tests/ Core/ Access/ AccessManagerTest.php - DefaultAccessCheckTest.php in core/
tests/ Drupal/ Tests/ Core/ Access/ DefaultAccessCheckTest.php
File
-
core/
lib/ Drupal/ Core/ Access/ DefaultAccessCheck.php, line 11
Namespace
Drupal\Core\AccessView source
class DefaultAccessCheck implements RoutingAccessInterface {
/**
* Checks access to the route based on the _access parameter.
*
* @param \Symfony\Component\Routing\Route $route
* The route to check against.
*
* @return \Drupal\Core\Access\AccessResultInterface
* The access result.
*/
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();
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
DefaultAccessCheck::access | public | function | Checks access to the route based on the _access parameter. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.