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