diff --git a/core/lib/Drupal/Core/Entity/EntityBCDecorator.php b/core/lib/Drupal/Core/Entity/EntityBCDecorator.php index d9c7a65..9c8b267 100644 --- a/core/lib/Drupal/Core/Entity/EntityBCDecorator.php +++ b/core/lib/Drupal/Core/Entity/EntityBCDecorator.php @@ -69,6 +69,13 @@ public function &__get($name) { // avoid them becoming out of sync. unset($this->decorated->fields[$name]); } + // Allow accessing field values in entity default languages other than + // LANGUAGE_DEFAULT by mapping the values to LANGUAGE_DEFAULT. + $langcode = $this->decorated->language()->langcode; + if ($langcode != LANGUAGE_DEFAULT && isset($this->decorated->values[$name][LANGUAGE_DEFAULT]) && !isset($this->decorated->values[$name][$langcode])) { + $this->decorated->values[$name][$langcode] = &$this->decorated->values[$name][LANGUAGE_DEFAULT]; + } + if (!isset($this->decorated->values[$name])) { $this->decorated->values[$name] = NULL; } diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php index 934ed62..836991a 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php @@ -289,7 +289,7 @@ protected function getEditValues($values, $langcode, $new = FALSE) { * The translation object to act on. */ protected function getTranslation(EntityInterface $entity, $langcode) { - return $entity instanceof EntityNG ? $entity->getTranslation($langcode) : $entity; + return $entity instanceof EntityNG ? $entity->getTranslation($langcode, FALSE) : $entity; } /**