You are here

public function AccessCheck::access in Zircon Profile 8.0

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()

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 23
Contains \Drupal\menu_test\Access\AccessCheck.

Class

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

Namespace

Drupal\menu_test\Access

Code

public function access() {
  if (!isset($_SESSION['menu_test'])) {
    $result = AccessResult::allowed();
  }
  else {
    $result = AccessResult::allowedIf($_SESSION['menu_test'] < 2);
  }
  return $result
    ->setCacheMaxAge(0);
}