diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module index a6a2a5e..e8a5fa5 100644 --- a/core/modules/content_translation/content_translation.module +++ b/core/modules/content_translation/content_translation.module @@ -335,13 +335,14 @@ function content_translation_entity_prepare_form(EntityInterface $entity, $opera // If the Content Translation form language differs from the current form // language and we are editing an entity translation, we need to update the // form language to match the specified value. - $langcode = \Drupal::languageManager()->getCurrentLanguage(ContentTranslationFormLanguage::TYPE)->getId(); + $langcode = NULL; $prepare_translation = $entity instanceof ContentEntityInterface && in_array($operation, ['default', 'edit']) && count($entity->getTranslationLanguages()) > 1 && !$form_state->get(['content_translation', 'source']) && !$form_state->get(['content_translation', 'translation_form']) && + ($langcode = \Drupal::languageManager()->getCurrentLanguage(ContentTranslationFormLanguage::TYPE)->getId()) && $entity->language()->getId() != $langcode && $entity->hasTranslation($langcode); diff --git a/core/modules/content_translation/src/Controller/ContentTranslationController.php b/core/modules/content_translation/src/Controller/ContentTranslationController.php index 83432f3..b4cc0e2 100644 --- a/core/modules/content_translation/src/Controller/ContentTranslationController.php +++ b/core/modules/content_translation/src/Controller/ContentTranslationController.php @@ -196,7 +196,7 @@ public function overview(RouteMatchInterface $route_match, $entity_type_id = NUL if ($update_access->isAllowed() && $entity_type->hasLinkTemplate('edit-form')) { $url = $entity->urlInfo('edit-form'); $url->setOption('query', [ContentTranslationFormLanguage::QUERY_PARAMETER => $langcode] + $destination); - $links['edit']['url'] = $entity->urlInfo('edit-form'); + $links['edit']['url'] = $url; } elseif (!$is_original && $translation_access->isAllowed()) { $links['edit']['url'] = $edit_url; diff --git a/core/modules/content_translation/src/Plugin/LanguageNegotiation/ContentTranslationFormLanguage.php b/core/modules/content_translation/src/Plugin/LanguageNegotiation/ContentTranslationFormLanguage.php index 4e77d96..9894fcc 100644 --- a/core/modules/content_translation/src/Plugin/LanguageNegotiation/ContentTranslationFormLanguage.php +++ b/core/modules/content_translation/src/Plugin/LanguageNegotiation/ContentTranslationFormLanguage.php @@ -14,7 +14,7 @@ /** * Class for identifying the content translation form language. * - * @Plugin( + * @LanguageNegotiation( * id = \Drupal\content_translation\Plugin\LanguageNegotiation\ContentTranslationFormLanguage::METHOD_ID, * types = {\Drupal\content_translation\Plugin\LanguageNegotiation\ContentTranslationFormLanguage::TYPE}, * weight = 0,