comparison core/lib/Drupal/Core/Ajax/AlertCommand.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
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 }