You are here

public function SessionTestController::getFromSessionObject in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php \Drupal\session_test\Controller\SessionTestController::getFromSessionObject()

Prints the stored session value to the screen.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The incoming request.

Return value

string A notification message.

1 string reference to 'SessionTestController::getFromSessionObject'
session_test.routing.yml in core/modules/system/tests/modules/session_test/session_test.routing.yml
core/modules/system/tests/modules/session_test/session_test.routing.yml

File

core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php, line 41
Contains \Drupal\session_test\Controller\SessionTestController.

Class

SessionTestController
Controller providing page callbacks for the action admin interface.

Namespace

Drupal\session_test\Controller

Code

public function getFromSessionObject(Request $request) {
  $value = $request
    ->getSession()
    ->get("session_test_key");
  return empty($value) ? [] : [
    '#markup' => $this
      ->t('The current value of the stored session variable is: %val', array(
      '%val' => $value,
    )),
  ];
}