You are here

function media_library_image_style_access in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/media_library/media_library.module \media_library_image_style_access()

Implements hook_ENTITY_TYPE_access().

File

core/modules/media_library/media_library.module, line 376
Contains hook implementations for the media_library module.

Code

function media_library_image_style_access(EntityInterface $entity, $operation, AccountInterface $account) {

  // Prevent the fallback 'media_library' image style from being deleted.
  // @todo: Lock the image style instead of preventing delete access.
  //   https://www.drupal.org/project/drupal/issues/2247293
  if ($operation === 'delete' && $entity
    ->id() === 'media_library') {
    return AccessResult::forbidden();
  }
}