function SessionTestController::get
Same name and namespace in other branches
- 9 core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php \Drupal\session_test\Controller\SessionTestController::get()
- 8.9.x core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php \Drupal\session_test\Controller\SessionTestController::get()
- 10 core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php \Drupal\session_test\Controller\SessionTestController::get()
Prints the stored session value to the screen.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The incoming request.
1 string reference to 'SessionTestController::get'
- 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 24
Class
- SessionTestController
- Controller providing page callbacks for session tests.
Namespace
Drupal\session_test\ControllerCode
public function get(Request $request) : array {
$value = $request->getSession()
->get('session_test_value');
return empty($value) ? [] : [
'#markup' => $this->t('The current value of the stored session variable is: %val', [
'%val' => $value,
]),
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.