class DefinedTestAccessCheck
Same name in other branches
- 9 core/modules/system/tests/modules/router_test_directory/src/Access/DefinedTestAccessCheck.php \Drupal\router_test\Access\DefinedTestAccessCheck
- 8.9.x core/modules/system/tests/modules/router_test_directory/src/Access/DefinedTestAccessCheck.php \Drupal\router_test\Access\DefinedTestAccessCheck
- 10 core/modules/system/tests/modules/router_test_directory/src/Access/DefinedTestAccessCheck.php \Drupal\router_test\Access\DefinedTestAccessCheck
Defines an access checker similar to DefaultAccessCheck.
Hierarchy
- class \Drupal\router_test\Access\DefinedTestAccessCheck implements \Drupal\Core\Routing\Access\AccessInterface
Expanded class hierarchy of DefinedTestAccessCheck
1 file declares its use of DefinedTestAccessCheck
- AccessManagerTest.php in core/
tests/ Drupal/ Tests/ Core/ Access/ AccessManagerTest.php
File
-
core/
modules/ system/ tests/ modules/ router_test_directory/ src/ Access/ DefinedTestAccessCheck.php, line 14
Namespace
Drupal\router_test\AccessView source
class DefinedTestAccessCheck implements AccessInterface {
/**
* Checks access.
*
* @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('_test_access') === 'TRUE') {
return AccessResult::allowed();
}
elseif ($route->getRequirement('_test_access') === 'FALSE') {
return AccessResult::forbidden();
}
else {
return AccessResult::neutral();
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
DefinedTestAccessCheck::access | public | function | Checks access. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.