function ContentTranslationTestHooks::entityAccess
Same name and namespace in other branches
- 11.x core/modules/content_translation/tests/modules/content_translation_test/src/Hook/ContentTranslationTestHooks.php \Drupal\content_translation_test\Hook\ContentTranslationTestHooks::entityAccess()
Implements hook_entity_access().
Attributes
#[Hook('entity_access')]
File
-
core/
modules/ content_translation/ tests/ modules/ content_translation_test/ src/ Hook/ ContentTranslationTestHooks.php, line 39
Class
- ContentTranslationTestHooks
- Hook implementations for content_translation_test.
Namespace
Drupal\content_translation_test\HookCode
public function entityAccess(EntityInterface $entity, $operation, AccountInterface $account) : AccessResultInterface {
$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.