function content_translation_translate_access
Same name in other branches
- 9 core/modules/content_translation/content_translation.module \content_translation_translate_access()
- 8.9.x core/modules/content_translation/content_translation.module \content_translation_translate_access()
- 11.x core/modules/content_translation/content_translation.module \content_translation_translate_access()
Access callback for the translation overview page.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity whose translation overview should be displayed.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
1 call to content_translation_translate_access()
- CommentLazyBuilders::access in core/
modules/ comment/ src/ CommentLazyBuilders.php - Wraps content_translation_translate_access.
1 string reference to 'content_translation_translate_access'
- content_translation_entity_type_alter in core/
modules/ content_translation/ content_translation.module - Implements hook_entity_type_alter().
File
-
core/
modules/ content_translation/ content_translation.module, line 374
Code
function content_translation_translate_access(EntityInterface $entity) {
$account = \Drupal::currentUser();
$condition = $entity instanceof ContentEntityInterface && $entity->access('view') && !$entity->getUntranslated()
->language()
->isLocked() && \Drupal::languageManager()->isMultilingual() && $entity->isTranslatable() && ($account->hasPermission('create content translations') || $account->hasPermission('update content translations') || $account->hasPermission('delete content translations') || $account->hasPermission('translate editable entities') && $entity->access('update'));
return AccessResult::allowedIf($condition)->cachePerPermissions()
->addCacheableDependency($entity);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.