function ContentTranslationTestHooks::entityAccess

Implements hook_entity_access().

File

core/modules/content_translation/tests/modules/content_translation_test/src/Hook/ContentTranslationTestHooks.php, line 38

Class

ContentTranslationTestHooks
Hook implementations for content_translation_test.

Namespace

Drupal\content_translation_test\Hook

Code

public function entityAccess(EntityInterface $entity, $operation, AccountInterface $account) {
    $access = \Drupal::state()->get('content_translation.entity_access.' . $entity->getEntityTypeId());
    if (!empty($access[$operation])) {
        return AccessResult::allowed();
    }
    else {
        return AccessResult::neutral();
    }
}

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