You are here

public function SessionTestController::setMessage in Drupal 10

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::setMessage()
  2. 9 core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php \Drupal\session_test\Controller\SessionTestController::setMessage()

Sets a message to me displayed on the following page.

Return value

string A notification message.

1 call to SessionTestController::setMessage()
SessionTestController::setMessageButDoNotSave in core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php
Sets a message but call drupal_save_session(FALSE).
1 string reference to 'SessionTestController::setMessage'
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 113

Class

SessionTestController
Controller providing page callbacks for the action admin interface.

Namespace

Drupal\session_test\Controller

Code

public function setMessage() {
  $this
    ->messenger()
    ->addStatus($this
    ->t('This is a dummy message.'));
  return new Response($this
    ->t('A message was set.'));

  // Do not return anything, so the current request does not result in a themed
  // page with messages. The message will be displayed in the following request
  // instead.
}