diff --git a/sources/content/src/Plugin/tmgmt/Source/ContentEntitySource.php b/sources/content/src/Plugin/tmgmt/Source/ContentEntitySource.php
index d72bee1bbaf6428c018307806c3d3ef2ef069ae7..9947916125969d3518ff5d034de2090a86331ce0 100644
--- a/sources/content/src/Plugin/tmgmt/Source/ContentEntitySource.php
+++ b/sources/content/src/Plugin/tmgmt/Source/ContentEntitySource.php
@@ -497,31 +497,11 @@ class ContentEntitySource extends SourcePluginBase implements SourcePreviewInter
$translation = $entity->getTranslation($target_langcode);
- // Create a revision if the entity is going to be saved. Embedded entities will have a revision created later on.
- if ($save && $entity->getEntityType()->isRevisionable()) {
- /** @var \Drupal\Core\Entity\TranslatableRevisionableStorageInterface $storage */
- $storage = \Drupal::entityTypeManager()->getStorage($entity->getEntityTypeId());
-
- if ($storage instanceof TranslatableRevisionableStorageInterface) {
- // Always create a new revision of the translation.
- $translation = $storage->createRevision($translation, $translation->isDefaultRevision());
- }
- }
-
$manager = \Drupal::service('content_translation.manager');
if ($manager->isEnabled($translation->getEntityTypeId(), $translation->bundle())) {
$manager->getTranslationMetadata($translation)->setSource($entity->language()->getId());
}
- if ($translation instanceof RevisionLogInterface) {
- $translation->setRevisionLogMessage($this->t('Created by translation job @label.', [
- ':url' => $item->getJob()->toUrl()->toString(),
- '@label' => $item->label(),
- ]));
- $translation->setRevisionUserId(\Drupal::currentUser()->id());
- $translation->setRevisionCreationTime(\Drupal::time()->getRequestTime());
- }
-
foreach (Element::children($data) as $field_name) {
$field_data = $data[$field_name];
@@ -543,6 +523,26 @@ class ContentEntitySource extends SourcePluginBase implements SourcePreviewInter
$field_processor->setTranslations($field_data, $field);
}
+ // Create a revision if the entity is going to be saved. Embedded entities will have a revision created later on.
+ if ($save && $entity->getEntityType()->isRevisionable()) {
+ /** @var \Drupal\Core\Entity\TranslatableRevisionableStorageInterface $storage */
+ $storage = \Drupal::entityTypeManager()->getStorage($entity->getEntityTypeId());
+
+ if ($storage instanceof TranslatableRevisionableStorageInterface) {
+ // Always create a new revision of the translation.
+ $translation = $storage->createRevision($translation, $translation->isDefaultRevision());
+ }
+ }
+
+ if ($translation instanceof RevisionLogInterface) {
+ $translation->setRevisionLogMessage($this->t('Created by translation job @label.', [
+ ':url' => $item->getJob()->toUrl()->toString(),
+ '@label' => $item->label(),
+ ]));
+ $translation->setRevisionUserId(\Drupal::currentUser()->id());
+ $translation->setRevisionCreationTime(\Drupal::time()->getRequestTime());
+ }
+
$embeddable_fields = static::getEmbeddableFields($entity);
foreach ($embeddable_fields as $field_name => $field_definition) {