class MediaLibraryGutenbergOpener in Gutenberg 8.2
Same name and namespace in other branches
- 8 src/MediaLibraryGutenbergOpener.php \Drupal\gutenberg\MediaLibraryGutenbergOpener
The media library opener for Gutenberg editor.
@package Drupal\gutenberg
Hierarchy
- class \Drupal\gutenberg\MediaLibraryGutenbergOpener implements MediaLibraryOpenerInterface
Expanded class hierarchy of MediaLibraryGutenbergOpener
1 string reference to 'MediaLibraryGutenbergOpener'
1 service uses MediaLibraryGutenbergOpener
File
- src/
MediaLibraryGutenbergOpener.php, line 16
Namespace
Drupal\gutenbergView source
class MediaLibraryGutenbergOpener implements MediaLibraryOpenerInterface {
/**
* {@inheritdoc}
*/
public function checkAccess(MediaLibraryState $state, AccountInterface $account) {
return AccessResult::allowedIf($account
->hasPermission('use gutenberg'));
}
/**
* {@inheritdoc}
*/
public function getSelectionResponse(MediaLibraryState $state, array $selected_ids) {
// This is not being triggered by Gutenberg and it's handled on React side,
// but we need to implement the interface, so we just return an empty AJAX
// response.
return new AjaxResponse();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MediaLibraryGutenbergOpener:: |
public | function |
Checks media library access. Overrides MediaLibraryOpenerInterface:: |
|
MediaLibraryGutenbergOpener:: |
public | function |
Generates a response after selecting media items in the media library. Overrides MediaLibraryOpenerInterface:: |