function MediaLibraryEditorOpener::getSelectionResponse
Same name in other branches
- 8.9.x core/modules/media_library/src/MediaLibraryEditorOpener.php \Drupal\media_library\MediaLibraryEditorOpener::getSelectionResponse()
- 10 core/modules/media_library/src/MediaLibraryEditorOpener.php \Drupal\media_library\MediaLibraryEditorOpener::getSelectionResponse()
- 11.x core/modules/media_library/src/MediaLibraryEditorOpener.php \Drupal\media_library\MediaLibraryEditorOpener::getSelectionResponse()
Overrides MediaLibraryOpenerInterface::getSelectionResponse
File
-
core/
modules/ media_library/ src/ MediaLibraryEditorOpener.php, line 63
Class
- MediaLibraryEditorOpener
- The media library opener for text editors.
Namespace
Drupal\media_libraryCode
public function getSelectionResponse(MediaLibraryState $state, array $selected_ids) {
$selected_media = $this->mediaStorage
->load(reset($selected_ids));
$response = new AjaxResponse();
$values = [
'attributes' => [
'data-entity-type' => 'media',
'data-entity-uuid' => $selected_media->uuid(),
'data-align' => 'center',
],
];
$response->addCommand(new EditorDialogSave($values));
return $response;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.