diff --git a/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php b/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php index 8e7f893..0c95f07 100644 --- a/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php +++ b/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php @@ -267,6 +267,11 @@ protected function attachLoad(&$queried_entities, $load_revision = FALSE) { /** * Maps from storage records to entity objects. * + * @param array $records + * Associative array of query results, keyed on the entity ID. + * @param boolean $load_revision + * (optional) TRUE if the revision should be loaded, defaults to FALSE. + * * @return array * An array of entity objects implementing the EntityInterface. */ diff --git a/core/lib/Drupal/Core/Entity/EntityNG.php b/core/lib/Drupal/Core/Entity/EntityNG.php index 35ef89d..2b620d4 100644 --- a/core/lib/Drupal/Core/Entity/EntityNG.php +++ b/core/lib/Drupal/Core/Entity/EntityNG.php @@ -258,10 +258,16 @@ public function getTranslationLanguages($include_default = TRUE) { $translations = array(); // Build an array with the translation langcodes set as keys. foreach ($this->getProperties() as $name => $property) { - if (isset($this->values[$name])) { - $translations += $this->values[$name]; + // @todo Figure out why we get localized non-translatable properties here + // and thus have to filter them! + $definition = $property->getDefinition(); + if (!empty($definition['translatable'])) { + if (isset($this->values[$name])) { + $translations += $this->values[$name]; + } + $translations += $this->fields[$name]; } - $translations += $this->fields[$name]; + } unset($translations[LANGUAGE_DEFAULT]); diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityRevisionsTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityRevisionsTest.php index 0216a19..244a5f9 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityRevisionsTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityRevisionsTest.php @@ -53,11 +53,10 @@ public function testRevisions() { // Create initial entity. // Basis settings. - $settings = array( + $entity = entity_create($entity_type, array( 'name' => 'foo', 'user_id' => $this->web_user->uid, - ); - $entity = entity_create($entity_type, $settings); + )); $entity->field_test_text->value = 'bar'; $entity->save(); diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTestTranslationUITest.php b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTestTranslationUITest.php index f66fcc3..00c7f79 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTestTranslationUITest.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTestTranslationUITest.php @@ -31,7 +31,8 @@ public static function getInfo() { * Overrides \Drupal\simpletest\WebTestBase::setUp(). */ function setUp() { - $this->entityType = 'entity_test'; + // Use the entity_test_data as this has multilingual property support. + $this->entityType = 'entity_test_data'; parent::setUp(); } 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..9762274 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 @@ -220,8 +220,10 @@ function testTranslationUI() { $this->drupalPost($path, array(), t('Delete translation')); $this->drupalPost(NULL, array(), t('Delete')); $entity = entity_load($this->entityType, $entity->id(), TRUE); - $translations = $entity->getTranslationLanguages(); - $this->assertTrue(count($translations) == 2 && empty($translations[$enabled_langcode]), 'Translation successfully deleted.'); + if ($this->assertTrue(is_object($entity), 'Entity found')) { + $translations = $entity->getTranslationLanguages(); + $this->assertTrue(count($translations) == 2 && empty($translations[$enabled_langcode]), 'Translation successfully deleted.'); + } } /**