function AnnounceCommand::__construct

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

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