Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / lib / Drupal / Core / Ajax / AlertCommand.php
1 <?php
2
3 namespace Drupal\Core\Ajax;
4
5 /**
6  * AJAX command for a javascript alert box.
7  *
8  * @ingroup ajax
9  */
10 class AlertCommand implements CommandInterface {
11
12   /**
13    * The text to be displayed in the alert box.
14    *
15    * @var string
16    */
17   protected $text;
18
19   /**
20    * Constructs an AlertCommand object.
21    *
22    * @param string $text
23    *   The text to be displayed in the alert box.
24    */
25   public function __construct($text) {
26     $this->text = $text;
27   }
28
29   /**
30    * Implements Drupal\Core\Ajax\CommandInterface:render().
31    */
32   public function render() {
33
34     return [
35       'command' => 'alert',
36       'text' => $this->text,
37     ];
38   }
39
40 }