function MediaLibraryTestHooks::mediaCreateAccess
Implements hook_ENTITY_TYPE_create_access().
File
-
core/
modules/ media_library/ tests/ modules/ media_library_test/ src/ Hook/ MediaLibraryTestHooks.php, line 22
Class
- MediaLibraryTestHooks
- Hook implementations for media_library_test.
Namespace
Drupal\media_library_test\HookCode
public function mediaCreateAccess(AccountInterface $account, array $context, $entity_bundle) {
if (isset($context['media_library_state'])) {
/** @var \Drupal\media_library\MediaLibraryState $state */
$state = $context['media_library_state'];
return AccessResult::forbiddenIf($state->getSelectedTypeId() === 'deny_access');
}
return AccessResult::neutral();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.