function MediaTypeAccessControlHandler::checkAccess

Same name in other branches
  1. 9 core/modules/media/src/MediaTypeAccessControlHandler.php \Drupal\media\MediaTypeAccessControlHandler::checkAccess()
  2. 8.9.x core/modules/media/src/MediaTypeAccessControlHandler.php \Drupal\media\MediaTypeAccessControlHandler::checkAccess()
  3. 10 core/modules/media/src/MediaTypeAccessControlHandler.php \Drupal\media\MediaTypeAccessControlHandler::checkAccess()

Overrides EntityAccessControlHandler::checkAccess

File

core/modules/media/src/MediaTypeAccessControlHandler.php, line 25

Class

MediaTypeAccessControlHandler
Defines the access control handler for the "Media Type" entity type.

Namespace

Drupal\media

Code

protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
    if ($operation === 'view label') {
        return AccessResult::allowedIfHasPermission($account, 'view media');
    }
    else {
        return parent::checkAccess($entity, $operation, $account);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.