You are here

public function SessionTestController::set in Drupal 8

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

Stores a value in $_SESSION['session_test_value'].

Parameters

string $test_value: A session value.

Return value

string A notification message.

1 call to SessionTestController::set()
SessionTestController::noSet in core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php
Turns off session saving and then tries to save a value anyway.
1 string reference to 'SessionTestController::set'
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 85

Class

SessionTestController
Controller providing page callbacks for the action admin interface.

Namespace

Drupal\session_test\Controller

Code

public function set($test_value) {
  $_SESSION['session_test_value'] = $test_value;
  return [
    '#markup' => $this
      ->t('The current value of the stored session variable has been set to %val', [
      '%val' => $test_value,
    ]),
  ];
}