diff --git a/core/lib/Drupal/Core/Entity/ContentEntityFormController.php b/core/lib/Drupal/Core/Entity/ContentEntityFormController.php index a987744..b9736e74 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityFormController.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityFormController.php @@ -96,15 +96,20 @@ protected function getTranslatedEntity(array $form_state) { */ public function getFormLangcode(array $form_state) { $entity = $this->entity; - // If no form langcode was provided we default to the current content - // language and inspect existing translations to find a valid fallback, - // if any. - $translations = $entity->getTranslationLanguages(); - $languageManager = \Drupal::languageManager(); - $langcode = $languageManager->getLanguage(Language::TYPE_CONTENT)->id; - $fallback = $languageManager->isMultilingual() ? language_fallback_get_candidates() : array(); - while (!empty($langcode) && !isset($translations[$langcode])) { - $langcode = array_shift($fallback); + if (!empty($form_state['langcode'])) { + $langcode = $form_state['langcode']; + } + else { + // If no form langcode was provided we default to the current content + // language and inspect existing translations to find a valid fallback, + // if any. + $translations = $entity->getTranslationLanguages(); + $languageManager = \Drupal::languageManager(); + $langcode = $languageManager->getLanguage(Language::TYPE_CONTENT)->id; + $fallback = $languageManager->isMultilingual() ? language_fallback_get_candidates() : array(); + while (!empty($langcode) && !isset($translations[$langcode])) { + $langcode = array_shift($fallback); + } } // If the site is not multilingual or no translation for the given form diff --git a/core/lib/Drupal/Core/Entity/EntityBCDecorator.php b/core/lib/Drupal/Core/Entity/EntityBCDecorator.php index f1547e7..23d244a 100644 --- a/core/lib/Drupal/Core/Entity/EntityBCDecorator.php +++ b/core/lib/Drupal/Core/Entity/EntityBCDecorator.php @@ -38,7 +38,7 @@ * * @todo: Remove once everything is converted to use the new entity field API. */ -class EntityBCDecorator implements IteratorAggregate, EntityInterface, TypedDataInterface { +class EntityBCDecorator implements IteratorAggregate, ContentEntityInterface { /** * The EntityInterface object being decorated.