You are here

public function AccessCheck::access in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/menu_test/src/Access/AccessCheck.php \Drupal\menu_test\Access\AccessCheck::access()
  2. 9 core/modules/system/tests/modules/menu_test/src/Access/AccessCheck.php \Drupal\menu_test\Access\AccessCheck::access()

Check to see if user accessed this page.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

File

core/modules/system/tests/modules/menu_test/src/Access/AccessCheck.php, line 48

Class

AccessCheck
Checks access based on the 'menu_test' key in session.

Namespace

Drupal\menu_test\Access

Code

public function access() {
  $result = AccessResult::allowedIf($this->requestStack
    ->getCurrentRequest()
    ->getSession()
    ->get('menu_test', 0) < 2);
  return $result
    ->setCacheMaxAge(0);
}