diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index 0b30053..ba516db 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -169,6 +169,16 @@ protected function typedDataManager() { } /** + * Returns the module handler. + * + * @return \Drupal\Core\Extension\ModuleHandlerInterface + * The module handler. + */ + protected function moduleHandler() { + return \Drupal::moduleHandler(); + } + + /** * {@inheritdoc} */ public function setNewRevision($value = TRUE) { @@ -542,7 +552,7 @@ protected function setDefaultLangcode() { $this->defaultLangcode = $item->language->id; } if (empty($this->defaultLangcode)) { - if (\Drupal::moduleHandler()->moduleExists('language')) { + if ($this->moduleHandler()->moduleExists('language')) { $this->defaultLangcode = language_get_default_langcode($this->getEntityTypeId(), $this->bundle()); } else { 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 294b498..3f9ee06 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php @@ -44,7 +44,7 @@ protected function _testEntityLanguageMethods($entity_type) { 'name' => 'test', 'user_id' => $this->container->get('current_user')->id(), )); - $this->assertEqual($entity->language()->id, language_default()->id, format_string('%entity_type: Entity created with API has default language.', array('%entity_type' => $entity_type))); + $this->assertEqual($entity->language()->id, Language::LANGCODE_DEFAULT, format_string('%entity_type: Entity created with API has default language.', array('%entity_type' => $entity_type))); $entity = entity_create($entity_type, array( 'name' => 'test',