You are here

public function AnnounceCommand::__construct in Drupal 9

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

Constructs an AnnounceCommand object.

Parameters

string $text: The text to be announced.

string|null $priority: (optional) The priority that will be used for the announcement. Defaults to NULL which will not set a 'priority' in the response sent to the client and therefore the JavaScript Drupal.announce() default of 'polite' will be used for the message.

File

core/lib/Drupal/Core/Ajax/AnnounceCommand.php, line 62

Class

AnnounceCommand
AJAX command for a JavaScript Drupal.announce() call.

Namespace

Drupal\Core\Ajax

Code

public function __construct($text, $priority = NULL) {
  $this->text = $text;
  $this->priority = $priority;
}