You are here

public function State::setMessage in Feeds 8.3

Sets a message to display to the user.

This should be used by plugins instead of the Drupal messenger service. It will store messages and display them at the appropriate time.

Parameters

string $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. Defaults to 'status'. These values are supported:

  • 'status'
  • 'warning'
  • 'error'.

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

Overrides StateInterface::setMessage

See also

\Drupal\Core\Messenger\MessengerInterface::addMessage()

File

src/State.php, line 113

Class

State
Status of the import or clearing operation of a Feed.

Namespace

Drupal\feeds

Code

public function setMessage($message = NULL, $type = 'status', $repeat = FALSE) {
  $this->messages[] = [
    'message' => $message,
    'type' => $type,
    'repeat' => $repeat,
  ];
}