function MessengerInterface::addMessage

Same name in other branches
  1. 9 core/lib/Drupal/Core/Messenger/MessengerInterface.php \Drupal\Core\Messenger\MessengerInterface::addMessage()
  2. 8.9.x core/lib/Drupal/Core/Messenger/MessengerInterface.php \Drupal\Core\Messenger\MessengerInterface::addMessage()
  3. 10 core/lib/Drupal/Core/Messenger/MessengerInterface.php \Drupal\Core\Messenger\MessengerInterface::addMessage()

Adds a new message to the queue.

The messages will be displayed in the order they got added later.

Parameters

string|\Drupal\Component\Render\MarkupInterface $message: (optional) The translated message to be displayed to the user. For consistency with other messages, it should begin with a capital letter and end with a period.

string $type: (optional) The message's type. Either self::TYPE_STATUS, self::TYPE_WARNING, or self::TYPE_ERROR.

bool $repeat: (optional) If this is FALSE and the message is already set, then the message won't be repeated. Defaults to FALSE.

Return value

$this

1 method overrides MessengerInterface::addMessage()
Messenger::addMessage in core/lib/Drupal/Core/Messenger/Messenger.php
Adds a new message to the queue.

File

core/lib/Drupal/Core/Messenger/MessengerInterface.php, line 45

Class

MessengerInterface
Stores runtime messages sent out to individual users on the page.

Namespace

Drupal\Core\Messenger

Code

public function addMessage($message, $type = self::TYPE_STATUS, $repeat = FALSE);

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.