diff --git a/core/lib/Drupal/Core/Entity/FieldableDatabaseStorageController.php b/core/lib/Drupal/Core/Entity/FieldableDatabaseStorageController.php index a639ee1..e207ea3 100644 --- a/core/lib/Drupal/Core/Entity/FieldableDatabaseStorageController.php +++ b/core/lib/Drupal/Core/Entity/FieldableDatabaseStorageController.php @@ -832,12 +832,14 @@ public function getQueryServiceName() { protected function doLoadFieldItems($entities, $age) { $load_current = $age == static::FIELD_LOAD_CURRENT; - // Collect entities ids and bundles. + // Collect entities ids, bundles and languages. $bundles = array(); $ids = array(); + $default_langcodes = array(); foreach ($entities as $key => $entity) { $bundles[$entity->bundle()] = TRUE; $ids[] = $load_current ? $key : $entity->getRevisionId(); + $default_langcodes[$key] = $entity->getUntranslated()->language()->id; } // Collect impacted fields. @@ -868,7 +870,7 @@ protected function doLoadFieldItems($entities, $age) { foreach ($results as $row) { // Ensure that records for non-translatable fields having invalid // languages are skipped. - if ($field->isFieldTranslatable() || $row->langcode == $entities[$row->entity_id]->getUntranslated()->language()->id) { + if ($row->langcode == $default_langcodes[$row->entity_id] || $field->isFieldTranslatable()) { if (!isset($delta_count[$row->entity_id][$row->langcode])) { $delta_count[$row->entity_id][$row->langcode] = 0; }