public function MediaLibraryFormElementOpener::checkAccess in Media Library Form API Element 8
Same name and namespace in other branches
- 2.x src/MediaLibraryFormElementOpener.php \Drupal\media_library_form_element\MediaLibraryFormElementOpener::checkAccess()
Checks media library access.
Parameters
\Drupal\media_library\MediaLibraryState $state: The media library.
\Drupal\Core\Session\AccountInterface $account: The user for which to check access.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
Overrides MediaLibraryOpenerInterface::checkAccess
See also
https://www.drupal.org/project/drupal/issues/3038254
File
- src/
MediaLibraryFormElementOpener.php, line 40
Class
- MediaLibraryFormElementOpener
- The media library opener for form elements.
Namespace
Drupal\media_library_form_elementCode
public function checkAccess(MediaLibraryState $state, AccountInterface $account) {
$process_result = function ($result) {
if ($result instanceof RefinableCacheableDependencyInterface) {
$result
->addCacheContexts([
'url.query_args',
]);
}
return $result;
};
return $process_result(AccessResult::allowed());
}