diff --git a/core/lib/Drupal/Core/Entity/Field/Type/EntityTranslation.php b/core/lib/Drupal/Core/Entity/Field/Type/EntityTranslation.php index 9ca0f87..d4052c5 100644 --- a/core/lib/Drupal/Core/Entity/Field/Type/EntityTranslation.php +++ b/core/lib/Drupal/Core/Entity/Field/Type/EntityTranslation.php @@ -193,10 +193,12 @@ public function isEmpty() { */ public function access($operation = 'view', \Drupal\user\Plugin\Core\Entity\User $account = NULL) { $method = $operation . 'Access'; + // 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. - $langocde = substr($this->getName(), 1); - return entity_access_controller($this->parent->entityType())->$method($this->parent, $langocde, $account); + $langcode = substr($this->getName(), 1); + return entity_access_controller($this->parent->entityType())->$method($this->parent, $langcode, $account); } /** diff --git a/core/lib/Drupal/Core/Entity/Field/Type/Field.php b/core/lib/Drupal/Core/Entity/Field/Type/Field.php index 0a82cf7..3766b92 100644 --- a/core/lib/Drupal/Core/Entity/Field/Type/Field.php +++ b/core/lib/Drupal/Core/Entity/Field/Type/Field.php @@ -42,10 +42,10 @@ class Field extends ContextAwareTypedData implements IteratorAggregate, FieldInt */ public function __construct(array $definition, $name = NULL, ContextAwareInterface $parent = NULL) { parent::__construct($definition, $name, $parent); - // Always initialize one empty item as usually that will be needed. That - // way prototypes created by + // Always initialize one empty item as most times a value for at least one + // item will be present. That way prototypes created by // \Drupal\Core\TypedData\TypedDataManager::getPropertyInstance() will - // already have one field item ready for use after cloning. + // already have this field item ready for use after cloning. $this->list[0] = $this->createItem(0); }