public function DefinedTestAccessCheck::access in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/modules/router_test_directory/src/Access/DefinedTestAccessCheck.php \Drupal\router_test\Access\DefinedTestAccessCheck::access()
- 9 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 23
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();
}
}