You are here

public function LegacyMessenger::addError in Drupal 8

Adds a new error message to the queue.

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.

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

Overrides MessengerInterface::addError

File

core/lib/Drupal/Core/Messenger/LegacyMessenger.php, line 40

Class

LegacyMessenger
Provides a LegacyMessenger implementation.

Namespace

Drupal\Core\Messenger

Code

public function addError($message, $repeat = FALSE) {
  return $this
    ->addMessage($message, static::TYPE_ERROR, $repeat);
}