function content_translation_test_entity_access

Same name in other branches
  1. 8.9.x core/modules/content_translation/tests/modules/content_translation_test/content_translation_test.module \content_translation_test_entity_access()
  2. 10 core/modules/content_translation/tests/modules/content_translation_test/content_translation_test.module \content_translation_test_entity_access()
  3. 11.x core/modules/content_translation/tests/modules/content_translation_test/content_translation_test.module \content_translation_test_entity_access()

Implements hook_entity_access().

File

core/modules/content_translation/tests/modules/content_translation_test/content_translation_test.module, line 32

Code

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