Interim commit.
[yaffs-website] / web / modules / contrib / entity_browser / src / Ajax / SelectEntitiesCommand.php
1 <?php
2
3 namespace Drupal\entity_browser\Ajax;
4
5 use Drupal\Core\Ajax\CommandInterface;
6
7 /**
8  * AJAX command to rerender a formatted text field without any transformation
9  * filters.
10  */
11 class SelectEntitiesCommand implements CommandInterface {
12
13   /**
14    * A unique identifier.
15    *
16    * @var string
17    */
18   protected $uuid;
19
20   /**
21    * A CSS selector string.
22    *
23    * @var array
24    */
25   protected $entities;
26
27   /**
28    * Constructs a \Drupal\entity_browser\Ajax\SelectEntities object.
29    *
30    * @param string $uuid
31    *   Entity browser instance UUID.
32    * @param array $entities
33    *   Entities that were selected. Each entity is represented with an array
34    *   consisting of three values (entity ID, entity UUID and entity type).
35    */
36   public function __construct($uuid, $entities) {
37     $this->uuid = $uuid;
38     $this->entities = $entities;
39   }
40
41   /**
42    * Implements \Drupal\Core\Ajax\CommandInterface::render().
43    */
44   public function render() {
45     return [
46       'command' => 'select_entities',
47       'uuid' => $this->uuid,
48       'entities' => $this->entities,
49     ];
50   }
51
52 }