function MessageCommand::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/Ajax/MessageCommand.php \Drupal\Core\Ajax\MessageCommand::__construct()
  2. 8.9.x core/lib/Drupal/Core/Ajax/MessageCommand.php \Drupal\Core\Ajax\MessageCommand::__construct()
  3. 11.x 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 110

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;
}

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