function DefinedTestAccessCheck::access
Same name in other branches
- 9 core/modules/system/tests/modules/router_test_directory/src/Access/DefinedTestAccessCheck.php \Drupal\router_test\Access\DefinedTestAccessCheck::access()
- 8.9.x core/modules/system/tests/modules/router_test_directory/src/Access/DefinedTestAccessCheck.php \Drupal\router_test\Access\DefinedTestAccessCheck::access()
- 10 core/modules/system/tests/modules/router_test_directory/src/Access/DefinedTestAccessCheck.php \Drupal\router_test\Access\DefinedTestAccessCheck::access()
Checks access.
Parameters
\Symfony\Component\Routing\Route $route: The route to check against.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
File
-
core/
modules/ system/ tests/ modules/ router_test_directory/ src/ Access/ DefinedTestAccessCheck.php, line 25
Class
- DefinedTestAccessCheck
- Defines an access checker similar to DefaultAccessCheck.
Namespace
Drupal\router_test\AccessCode
public function access(Route $route) {
if ($route->getRequirement('_test_access') === 'TRUE') {
return AccessResult::allowed();
}
elseif ($route->getRequirement('_test_access') === 'FALSE') {
return AccessResult::forbidden();
}
else {
return AccessResult::neutral();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.