class AccessCheck in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/tests/modules/menu_test/src/Access/AccessCheck.php \Drupal\menu_test\Access\AccessCheck
Checks access based on the 'menu_test' key in session.
Hierarchy
- class \Drupal\menu_test\Access\AccessCheck implements AccessInterface
Expanded class hierarchy of AccessCheck
1 string reference to 'AccessCheck'
- menu_test.services.yml in core/
modules/ system/ tests/ modules/ menu_test/ menu_test.services.yml - core/modules/system/tests/modules/menu_test/menu_test.services.yml
1 service uses AccessCheck
- access_check.menu_test_session in core/
modules/ system/ tests/ modules/ menu_test/ menu_test.services.yml - Drupal\menu_test\Access\AccessCheck
File
- core/
modules/ system/ tests/ modules/ menu_test/ src/ Access/ AccessCheck.php, line 15 - Contains \Drupal\menu_test\Access\AccessCheck.
Namespace
Drupal\menu_test\AccessView source
class AccessCheck implements AccessInterface {
/**
* Check to see if user accessed this page.
*
* @return \Drupal\Core\Access\AccessResultInterface
* The access result.
*/
public function access() {
if (!isset($_SESSION['menu_test'])) {
$result = AccessResult::allowed();
}
else {
$result = AccessResult::allowedIf($_SESSION['menu_test'] < 2);
}
return $result
->setCacheMaxAge(0);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AccessCheck:: |
public | function | Check to see if user accessed this page. |