Implements hook_entity_access().

Fichier

modules/entity_clone_extras/entity_clone_extras.module, line 57

Code

function entity_clone_extras_entity_access(EntityInterface $entity, $operation, AccountInterface $account) {
    $entity_types = _entity_clone_extra_supported_entity_types();
    if ($operation === 'clone' && in_array($entity->getEntityTypeId(), $entity_types)) {
        return AccessResult::allowedIfHasPermission($account, 'clone ' . $entity->bundle() . ' ' . $entity->getEntityTypeId() . ' entities');
    }
    return AccessResult::neutral();
}