X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fcontent_moderation%2Fsrc%2FEntityOperations.php;h=8c6d3325089840426b950cfebeaef7f20fe03ad8;hp=9ab40eac05691fb70202c4bbfb4f26377690d5a2;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hpb=9424afc6c1f518c301bf87a23c047d1873435d05 diff --git a/web/core/modules/content_moderation/src/EntityOperations.php b/web/core/modules/content_moderation/src/EntityOperations.php index 9ab40eac0..8c6d33250 100644 --- a/web/core/modules/content_moderation/src/EntityOperations.php +++ b/web/core/modules/content_moderation/src/EntityOperations.php @@ -184,11 +184,16 @@ class EntityOperations implements ContainerInjectionInterface { // Sync translations. if ($entity->getEntityType()->hasKey('langcode')) { $entity_langcode = $entity->language()->getId(); - if (!$content_moderation_state->hasTranslation($entity_langcode)) { - $content_moderation_state->addTranslation($entity_langcode); + if ($entity->isDefaultTranslation()) { + $content_moderation_state->langcode = $entity_langcode; } - if ($content_moderation_state->language()->getId() !== $entity_langcode) { - $content_moderation_state = $content_moderation_state->getTranslation($entity_langcode); + else { + if (!$content_moderation_state->hasTranslation($entity_langcode)) { + $content_moderation_state->addTranslation($entity_langcode); + } + if ($content_moderation_state->language()->getId() !== $entity_langcode) { + $content_moderation_state = $content_moderation_state->getTranslation($entity_langcode); + } } }