Mercurial > hg > isophonics-drupal-site
comparison core/lib/Drupal/Core/Ajax/BaseCommand.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 * Base command that only exists to simplify AJAX commands. | |
7 */ | |
8 class BaseCommand implements CommandInterface { | |
9 | |
10 /** | |
11 * The name of the command. | |
12 * | |
13 * @var string | |
14 */ | |
15 protected $command; | |
16 | |
17 /** | |
18 * The data to pass on to the client side. | |
19 * | |
20 * @var string | |
21 */ | |
22 protected $data; | |
23 | |
24 /** | |
25 * Constructs a BaseCommand object. | |
26 * | |
27 * @param string $command | |
28 * The name of the command. | |
29 * @param string $data | |
30 * The data to pass on to the client side. | |
31 */ | |
32 public function __construct($command, $data) { | |
33 $this->command = $command; | |
34 $this->data = $data; | |
35 } | |
36 | |
37 /** | |
38 * {@inheritdoc} | |
39 */ | |
40 public function render() { | |
41 return [ | |
42 'command' => $this->command, | |
43 'data' => $this->data, | |
44 ]; | |
45 } | |
46 | |
47 } |