diff --git a/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php b/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php index 3597d5a..bb0cf4c 100644 --- a/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php +++ b/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php @@ -560,7 +560,7 @@ protected function mapToRevisionStorageRecord(EntityInterface $entity) { * The record to store. */ protected function mapToDataStorageRecord(EntityInterface $entity, $langcode) { - $default_langcode = $entity->getUntranslated()->language()->langcode; + $default_langcode = $entity->getUntranslated()->language()->id; // Don't use strict mode, this way there's no need to do checks here, as // non-translatable properties are replicated for each language. $translation = $entity->getTranslation($langcode); diff --git a/core/lib/Drupal/Core/Entity/EntityNG.php b/core/lib/Drupal/Core/Entity/EntityNG.php index 61a013f..a7bf102 100644 --- a/core/lib/Drupal/Core/Entity/EntityNG.php +++ b/core/lib/Drupal/Core/Entity/EntityNG.php @@ -156,7 +156,7 @@ public function __construct(array $values, $entity_type, $bundle = FALSE, $trans $data = array('status' => self::$TRANSLATION_EXISTING); $this->translations[Language::LANGCODE_DEFAULT] = $data; if ($translations) { - $default_langcode = $this->language()->langcode; + $default_langcode = $this->language()->id; foreach ($translations as $langcode) { if ($langcode != $default_langcode && $langcode != Language::LANGCODE_DEFAULT) { $this->translations[$langcode] = $data; diff --git a/core/modules/field/field.module b/core/modules/field/field.module index 0dca8b9..ad11478 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -235,7 +235,7 @@ function field_system_info_alter(&$info, $file, $type) { function field_entity_create(EntityInterface $entity) { $info = $entity->entityInfo(); if (!empty($info['fieldable'])) { - field_populate_default_values($entity, $entity->language()->langcode); + field_populate_default_values($entity, $entity->language()->id); } } diff --git a/core/modules/field/lib/Drupal/field/Tests/TranslationWebTest.php b/core/modules/field/lib/Drupal/field/Tests/TranslationWebTest.php index c65de42..df93f12 100644 --- a/core/modules/field/lib/Drupal/field/Tests/TranslationWebTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/TranslationWebTest.php @@ -117,7 +117,7 @@ function testFieldFormTranslationRevisions() { $entity->save(); // Create a new revision. - $langcode = $entity->language()->langcode; + $langcode = $entity->language()->id; $edit = array( 'user_id' => 1, 'name' => $this->randomName(), diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php index 95d9f89..6bd3228 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php @@ -354,8 +354,8 @@ function testEntityTranslationAPI() { $translation = $entity->addTranslation($langcode); $this->assertNotEqual($entity, $translation, 'The entity and the translation object differ from one another.'); $this->assertTrue($entity->hasTranslation($langcode), 'The new translation exists.'); - $this->assertEqual($translation->language()->langcode, $langcode, 'The translation language matches the specified one.'); - $this->assertEqual($translation->getUntranslated()->language()->langcode, $default_langcode, 'The original language can still be retrieved.'); + $this->assertEqual($translation->language()->id, $langcode, 'The translation language matches the specified one.'); + $this->assertEqual($translation->getUntranslated()->language()->id, $default_langcode, 'The original language can still be retrieved.'); $translation->name->value = $name_translated; $this->assertEqual($entity->name->value, $name, 'The original name is retained after setting a translated value.'); $entity->name->value = $name; @@ -369,16 +369,16 @@ function testEntityTranslationAPI() { // Check that after loading an entity the language is the default one. $entity = $this->reloadEntity($entity); - $this->assertEqual($entity->language()->langcode, $default_langcode, 'The loaded entity is the original one.'); + $this->assertEqual($entity->language()->id, $default_langcode, 'The loaded entity is the original one.'); // Add another translation and check that everything works as expected. A // new translation object can be obtained also by just specifying a valid // language. $langcode2 = $this->langcodes[2]; $translation = $entity->getTranslation($langcode2); - $value = $entity != $translation && $translation->language()->langcode == $langcode2 && $entity->hasTranslation($langcode2); + $value = $entity != $translation && $translation->language()->id == $langcode2 && $entity->hasTranslation($langcode2); $this->assertTrue($value, 'A new translation object can be obtained also by specifying a valid language.'); - $this->assertEqual($entity->language()->langcode, $default_langcode, 'The original language has been preserved.'); + $this->assertEqual($entity->language()->id, $default_langcode, 'The original language has been preserved.'); $translation->save(); $hooks = $this->getHooksInfo(); $this->assertEqual($hooks['entity_translation_insert'], $langcode2, 'The generic entity translation insertion hook has fired.'); diff --git a/core/modules/system/tests/modules/entity_test/entity_test.module b/core/modules/system/tests/modules/entity_test/entity_test.module index 03dc4dc..264787e 100644 --- a/core/modules/system/tests/modules/entity_test/entity_test.module +++ b/core/modules/system/tests/modules/entity_test/entity_test.module @@ -439,28 +439,28 @@ function entity_test_entity_operation_alter(array &$operations, EntityInterface * Implements hook_entity_translation_insert(). */ function entity_test_entity_translation_insert(EntityInterface $translation) { - _entity_test_record_hooks('entity_translation_insert', $translation->language()->langcode); + _entity_test_record_hooks('entity_translation_insert', $translation->language()->id); } /** * Implements hook_entity_translation_delete(). */ function entity_test_entity_translation_delete(EntityInterface $translation) { - _entity_test_record_hooks('entity_translation_delete', $translation->language()->langcode); + _entity_test_record_hooks('entity_translation_delete', $translation->language()->id); } /** * Implements hook_ENTITY_TYPE_translation_insert(). */ function entity_test_entity_test_mul_translation_insert(EntityInterface $translation) { - _entity_test_record_hooks('entity_test_mul_translation_insert', $translation->language()->langcode); + _entity_test_record_hooks('entity_test_mul_translation_insert', $translation->language()->id); } /** * Implements hook_ENTITY_TYPE_translation_delete(). */ function entity_test_entity_test_mul_translation_delete(EntityInterface $translation) { - _entity_test_record_hooks('entity_test_mul_translation_delete', $translation->language()->langcode); + _entity_test_record_hooks('entity_test_mul_translation_delete', $translation->language()->id); } /** diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php index 91b2586..4f4043a 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php @@ -47,7 +47,7 @@ public function form(array $form, array &$form_state) { '#type' => 'language_select', '#title' => t('Language'), '#languages' => Language::STATE_ALL, - '#default_value' => $term->getUntranslated()->language()->langcode, + '#default_value' => $term->getUntranslated()->language()->id, '#access' => !is_null($language_configuration['language_show']) && $language_configuration['language_show'], );