diff --git a/core/lib/Drupal/Core/Entity/ContentEntityFormController.php b/core/lib/Drupal/Core/Entity/ContentEntityFormController.php index de83f56..50c328b 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityFormController.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityFormController.php @@ -110,10 +110,15 @@ protected function init(array &$form_state) { */ public function getFormLangcode(array &$form_state) { if (empty($form_state['langcode'])) { - // Imply a 'view' operation to ensure users edit entities in the same - // language they are displayed. This allows to keep contextual editing - // working also for multilingual entities. - $form_state['langcode'] = $this->entityManager->getTranslationFromContext($this->entity)->language()->id; + // Try to load the target langcode from a query parameter. If this is not + // given, load it via current context. + $content_translation_target = \Drupal::request()->get('content_translation_target'); + if (isset($content_translation_target)) { + $form_state['langcode'] = $content_translation_target; + } + else { + $form_state['langcode'] = $this->entityManager->getTranslationFromContext($this->entity)->language()->id; + } } return $form_state['langcode']; } diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php index 62a0e51..9b575cf 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php @@ -222,10 +222,7 @@ protected function doTestAuthoringInfo() { * Tests the form language switch functionality. */ protected function assertFormLanguage() { - $entity = $this->container - ->get('plugin.manager.entity') - ->getStorageController($this->entityType) - ->load($this->entityId); + $entity = entity_load($this->entityType, $this->entityId, TRUE); $uri = $entity->uri('edit-form'); $message = 'The form language can be switched to @langcode through a query string parameter';