Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/media_library/src/Ajax/UpdateSelectionCommand.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\media_library\Ajax; | |
4 | |
5 use Drupal\Core\Ajax\CommandInterface; | |
6 | |
7 /** | |
8 * AJAX command for adding media items to the media library selection. | |
9 * | |
10 * This command instructs the client to add the given media item IDs to the | |
11 * current selection of the media library stored in | |
12 * Drupal.MediaLibrary.currentSelection. | |
13 * | |
14 * This command is implemented by | |
15 * Drupal.AjaxCommands.prototype.updateMediaLibrarySelection() defined in | |
16 * media_library.ui.js. | |
17 * | |
18 * @ingroup ajax | |
19 * | |
20 * @internal | |
21 * Media Library is an experimental module and its internal code may be | |
22 * subject to change in minor releases. External code should not instantiate | |
23 * or extend this class. | |
24 */ | |
25 class UpdateSelectionCommand implements CommandInterface { | |
26 | |
27 /** | |
28 * An array of media IDs to add to the current selection. | |
29 * | |
30 * @var int[] | |
31 */ | |
32 protected $mediaIds; | |
33 | |
34 /** | |
35 * Constructs an UpdateSelectionCommand object. | |
36 * | |
37 * @param int[] $media_ids | |
38 * An array of media IDs to add to the current selection. | |
39 */ | |
40 public function __construct(array $media_ids) { | |
41 $this->mediaIds = $media_ids; | |
42 } | |
43 | |
44 /** | |
45 * {@inheritdoc} | |
46 */ | |
47 public function render() { | |
48 return [ | |
49 'command' => 'updateMediaLibrarySelection', | |
50 'mediaIds' => $this->mediaIds, | |
51 ]; | |
52 } | |
53 | |
54 } |