function MessageCommand::render

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

Return an array to be run through json_encode and sent to the client.

Overrides CommandInterface::render

File

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

Class

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

Namespace

Drupal\Core\Ajax

Code

public function render() {
  return [
    'command' => 'message',
    'message' => $this->message instanceof MarkupInterface ? (string) $this->message : Xss::filterAdmin($this->message),
    'messageWrapperQuerySelector' => $this->wrapperQuerySelector,
    'messageOptions' => $this->options,
    'clearPrevious' => $this->clearPrevious,
  ];
}

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