annotate core/lib/Drupal/Core/Ajax/AlertCommand.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\Core\Ajax;
Chris@0 4
Chris@0 5 /**
Chris@0 6 * AJAX command for a javascript alert box.
Chris@0 7 *
Chris@0 8 * @ingroup ajax
Chris@0 9 */
Chris@0 10 class AlertCommand implements CommandInterface {
Chris@0 11
Chris@0 12 /**
Chris@0 13 * The text to be displayed in the alert box.
Chris@0 14 *
Chris@0 15 * @var string
Chris@0 16 */
Chris@0 17 protected $text;
Chris@0 18
Chris@0 19 /**
Chris@0 20 * Constructs an AlertCommand object.
Chris@0 21 *
Chris@0 22 * @param string $text
Chris@0 23 * The text to be displayed in the alert box.
Chris@0 24 */
Chris@0 25 public function __construct($text) {
Chris@0 26 $this->text = $text;
Chris@0 27 }
Chris@0 28
Chris@0 29 /**
Chris@0 30 * Implements Drupal\Core\Ajax\CommandInterface:render().
Chris@0 31 */
Chris@0 32 public function render() {
Chris@0 33
Chris@0 34 return [
Chris@0 35 'command' => 'alert',
Chris@0 36 'text' => $this->text,
Chris@0 37 ];
Chris@0 38 }
Chris@0 39
Chris@0 40 }