You are here

public function MessageCommand::__construct in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Ajax/MessageCommand.php \Drupal\Core\Ajax\MessageCommand::__construct()

Constructs a MessageCommand object.

Parameters

string $message: The text of the message.

string|null $wrapper_query_selector: The query selector of the element to display messages in when they should be displayed somewhere other than the default. @see Drupal.Message.defaultWrapper()

array $options: The options passed to Drupal.message().add().

bool $clear_previous: If TRUE, previous messages will be cleared first.

File

core/lib/Drupal/Core/Ajax/MessageCommand.php, line 72

Class

MessageCommand
AJAX command for a JavaScript Drupal.message() call.

Namespace

Drupal\Core\Ajax

Code

public function __construct($message, $wrapper_query_selector = NULL, array $options = [], $clear_previous = TRUE) {
  $this->message = $message;
  $this->wrapperQuerySelector = $wrapper_query_selector;
  $this->options = $options;
  $this->clearPrevious = $clear_previous;
}