class WebformAnnounceCommand in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Ajax/WebformAnnounceCommand.php \Drupal\webform\Ajax\WebformAnnounceCommand
Provides an Ajax command to trigger audio UAs to read the supplied text.
This command is implemented in Drupal.AjaxCommands.prototype.webformAnnounce.
Hierarchy
- class \Drupal\webform\Ajax\WebformAnnounceCommand implements CommandInterface
Expanded class hierarchy of WebformAnnounceCommand
File
- src/
Ajax/ WebformAnnounceCommand.php, line 12
Namespace
Drupal\webform\AjaxView source
class WebformAnnounceCommand implements CommandInterface {
/**
* A string to be read by the UA.
*
* @var string
*/
protected $text;
/**
* A string to indicate the priority of the message.
*
* Can be either 'polite' or 'assertive'.
*
* @var string
*/
protected $priority;
/**
* Constructs a WebformAnnounceCommand object.
*
* @param string $text
* A string to be read by the UA.
* @param string $priority
* A string to indicate the priority of the message. Can be either
* 'polite' or 'assertive'.
*/
public function __construct($text, $priority = 'polite') {
$this->text = $text;
$this->priority = $priority;
}
/**
* {@inheritdoc}
*/
public function render() {
return [
'command' => 'webformAnnounce',
'text' => $this->text,
'priority' => $this->priority,
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
WebformAnnounceCommand:: |
protected | property | A string to indicate the priority of the message. | |
WebformAnnounceCommand:: |
protected | property | A string to be read by the UA. | |
WebformAnnounceCommand:: |
public | function |
Return an array to be run through json_encode and sent to the client. Overrides CommandInterface:: |
|
WebformAnnounceCommand:: |
public | function | Constructs a WebformAnnounceCommand object. |