diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module index a6d0850..a6a2a5e 100644 --- a/core/modules/content_translation/content_translation.module +++ b/core/modules/content_translation/content_translation.module @@ -335,15 +335,15 @@ 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 = NULL; + $langcode = \Drupal::languageManager()->getCurrentLanguage(ContentTranslationFormLanguage::TYPE)->getId(); $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); + $entity->language()->getId() != $langcode && + $entity->hasTranslation($langcode); if ($prepare_translation) { /** @var \Drupal\Core\Entity\EntityFormInterface $form_object*/