function MessageCommand::__construct

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Ajax/MessageCommand.php \Drupal\Core\Ajax\MessageCommand::__construct()
  2. 10 core/lib/Drupal/Core/Ajax/MessageCommand.php \Drupal\Core\Ajax\MessageCommand::__construct()
  3. 9 core/lib/Drupal/Core/Ajax/MessageCommand.php \Drupal\Core\Ajax\MessageCommand::__construct()
  4. 8.9.x core/lib/Drupal/Core/Ajax/MessageCommand.php \Drupal\Core\Ajax\MessageCommand::__construct()

Constructs a MessageCommand object.

Parameters

string|\Drupal\Component\Render\MarkupInterface $message: The text of the message.

string|null $wrapperQuerySelector: 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 $clearPrevious: If TRUE, previous messages will be cleared first.

File

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

Class

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

Namespace

Drupal\Core\Ajax

Code

public function __construct(protected $message, protected $wrapperQuerySelector = NULL, protected array $options = [], protected $clearPrevious = TRUE) {
}

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