--- a/core/lib/Drupal/Core/Entity/EntityNG.php +++ b/core/lib/Drupal/Core/Entity/EntityNG.php @@ -392,18 +392,20 @@ public function getTranslationLanguages($include_default = TRUE) { $definitions = $this->getPropertyDefinitions(); // Build an array with the translation langcodes set as keys. Empty // translations should not be included and must be skipped. - foreach ($this->getProperties() as $name => $property) { - foreach ($this->fields[$name] as $langcode => $field) { - if (!$field->isEmpty()) { - $translations[$langcode] = TRUE; + foreach ($definitions as $name => $definition) { + if (isset($this->fields[$name])) { + foreach ($this->fields[$name] as $langcode => $field) { + if (!$field->isEmpty()) { + $translations[$langcode] = TRUE; + } } - if (isset($this->values[$name])) { - foreach ($this->values[$name] as $langcode => $values) { - // If a value is there but the field object is empty, it has been - // unset, so we need to skip the field also. - if ($values && !empty($definitions[$name]['translatable']) && !(isset($this->fields[$name][$langcode]) && $this->fields[$name][$langcode]->isEmpty())) { - $translations[$langcode] = TRUE; - } + } + if (isset($this->values[$name])) { + foreach ($this->values[$name] as $langcode => $values) { + // If a value is there but the field object is empty, it has been + // unset, so we need to skip the field also. + if ($values && !empty($definition['translatable']) && !(isset($this->fields[$name][$langcode]) && $this->fields[$name][$langcode]->isEmpty())) { + $translations[$langcode] = TRUE; } } }