AnnounceCommand
class AnnounceCommand implements CommandInterface, CommandWithAttachedAssetsInterface (View source)
AJAX command for a JavaScript Drupal.announce() call.
Developers should be extra careful if this command and \Drupal\Core\Ajax\MessageCommand are included in the same response. By default, MessageCommand will also call Drupal.announce() and announce the message to the screen reader (unless the option to suppress announcements is passed to the constructor). Manual testing with a screen reader is strongly recommended.
Constants
| PRIORITY_ASSERTIVE |
The assertive priority attribute value. |
| PRIORITY_POLITE |
The polite priority attribute value. |
Properties
| protected string | $text | The text to be announced. |
|
| protected string | $priority | The priority that will be used for the announcement. |
Methods
Constructs an AnnounceCommand object.
Return an array to be run through json_encode and sent to the client.
Gets the attached assets.
Details
__construct(string $text, string|null $priority = NULL)
Constructs an AnnounceCommand object.
render()
Return an array to be run through json_encode and sent to the client.
AttachedAssets|null
getAttachedAssets()
Gets the attached assets.