content_translation_translate_access(EntityInterface $entity)
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.
File
- core/modules/content_translation/content_translation.module, line 280
- Allows entities to be translated into different languages.
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'));
return AccessResult::allowedIf($condition)->cachePerPermissions()->addCacheableDependency($entity);
}
Please login to continue.