function translation_entity_view_access

Checks whether the given user can view the specified translation.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity whose translation overview should be displayed.

$langcode: The language code of the translation to be displayed.

\Drupal\Core\Session\AccountInterface $account: (optional) The account for which view access should be checked. Defaults to the current user.

1 call to translation_entity_view_access()
translation_entity_field_language_alter in drupal/core/modules/translation_entity/translation_entity.module
Implements hook_field_language_alter().

File

drupal/core/modules/translation_entity/translation_entity.module, line 297
Allows entities to be translated into different languages.

Code

function translation_entity_view_access(EntityInterface $entity, $langcode, AccountInterface $account = NULL) {
  $entity_type = $entity
    ->entityType();
  return !empty($entity->translation[$langcode]['status']) || user_access('translate any entity', $account) || user_access("translate {$entity_type} entities", $account);
}