class DefinedTestAccessCheck in Drupal 8
Same name and namespace in other branches
- 9 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 AccessInterface
Expanded class hierarchy of DefinedTestAccessCheck
1 file declares its use of DefinedTestAccessCheck
- AccessManagerTest.php in core/
tests/ Drupal/ Tests/ Core/ Access/ AccessManagerTest.php - Contains \Drupal\Tests\Core\Access\AccessManagerTest.
File
- core/
modules/ system/ tests/ modules/ router_test_directory/ src/ Access/ DefinedTestAccessCheck.php, line 12
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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DefinedTestAccessCheck:: |
public | function | Checks access. |