class UpdateSelectionCommand
Same name in other branches
- 8.9.x core/modules/media_library/src/Ajax/UpdateSelectionCommand.php \Drupal\media_library\Ajax\UpdateSelectionCommand
- 10 core/modules/media_library/src/Ajax/UpdateSelectionCommand.php \Drupal\media_library\Ajax\UpdateSelectionCommand
- 11.x core/modules/media_library/src/Ajax/UpdateSelectionCommand.php \Drupal\media_library\Ajax\UpdateSelectionCommand
AJAX command for adding media items to the media library selection.
This command instructs the client to add the given media item IDs to the current selection of the media library stored in Drupal.MediaLibrary.currentSelection.
This command is implemented by Drupal.AjaxCommands.prototype.updateMediaLibrarySelection() defined in media_library.ui.js.
@internal This is an internal part of Media Library and may be subject to change in minor releases. External code should not instantiate or extend this class.
Hierarchy
- class \Drupal\media_library\Ajax\UpdateSelectionCommand implements \Drupal\Core\Ajax\CommandInterface
Expanded class hierarchy of UpdateSelectionCommand
Related topics
1 file declares its use of UpdateSelectionCommand
- AddFormBase.php in core/
modules/ media_library/ src/ Form/ AddFormBase.php
File
-
core/
modules/ media_library/ src/ Ajax/ UpdateSelectionCommand.php, line 24
Namespace
Drupal\media_library\AjaxView source
class UpdateSelectionCommand implements CommandInterface {
/**
* An array of media IDs to add to the current selection.
*
* @var int[]
*/
protected $mediaIds;
/**
* Constructs an UpdateSelectionCommand object.
*
* @param int[] $media_ids
* An array of media IDs to add to the current selection.
*/
public function __construct(array $media_ids) {
$this->mediaIds = $media_ids;
}
/**
* {@inheritdoc}
*/
public function render() {
return [
'command' => 'updateMediaLibrarySelection',
'mediaIds' => $this->mediaIds,
];
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
UpdateSelectionCommand::$mediaIds | protected | property | An array of media IDs to add to the current selection. | |
UpdateSelectionCommand::render | public | function | Return an array to be run through json_encode and sent to the client. | Overrides CommandInterface::render |
UpdateSelectionCommand::__construct | public | function | Constructs an UpdateSelectionCommand object. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.