public function EntityTranslation::access

Implements \Drupal\Core\TypedData\AccessibleInterface::access().

Overrides AccessibleInterface::access

File

drupal/core/lib/Drupal/Core/Entity/Field/Type/EntityTranslation.php, line 214
Contains \Drupal\Core\Entity\Type\EntityTranslation.

Class

EntityTranslation
Allows accessing and updating translated entity fields.

Namespace

Drupal\Core\Entity\Field\Type

Code

public function access($operation = 'view', AccountInterface $account = NULL) {

  // Determine the language code of this translation by cutting of the
  // leading "@" from the property name to get the langcode.
  // @todo Add a way to set and get the langcode so that's more obvious what
  // we're doing here.
  $langcode = substr($this
    ->getName(), 1);
  return \Drupal::entityManager()
    ->getAccessController($this->parent
    ->entityType())
    ->access($this->parent, $operation, $langcode, $account);
}