function media_library_test_media_create_access

Same name in other branches
  1. 10 core/modules/media_library/tests/modules/media_library_test/media_library_test.module \media_library_test_media_create_access()
  2. 11.x core/modules/media_library/tests/modules/media_library_test/media_library_test.module \media_library_test_media_create_access()

Implements hook_ENTITY_TYPE_create_access().

File

core/modules/media_library/tests/modules/media_library_test/media_library_test.module, line 17

Code

function media_library_test_media_create_access(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.