π | Translation Management Tool | Enforce source language set wrong source field in content_translation
π©πͺGermany WalterP
The following patch solves the problem for us:
diff --git a/sources/content/src/Plugin/tmgmt/Source/ContentEntitySource.php b/sources/content/src/Plugin/tmgmt/Source/ContentEntitySource.php
index b101d7b2..099d1b78 100644
--- a/sources/content/src/Plugin/tmgmt/Source/ContentEntitySource.php
+++ b/sources/content/src/Plugin/tmgmt/Source/ContentEntitySource.php
@@ -498,7 +498,7 @@ class ContentEntitySource extends SourcePluginBase implements SourcePreviewInter
$translation = $entity->getTranslation($target_langcode);
$manager = \Drupal::service('content_translation.manager');
if ($manager->isEnabled($translation->getEntityTypeId(), $translation->bundle())) {
- $manager->getTranslationMetadata($translation)->setSource($entity->language()->getId());
+ $manager->getTranslationMetadata($translation)->setSource($item->getJob()->getSourceLangcode());
}
foreach (Element::children($data) as $field_name) {
π | Translation Management Tool | Enforce source language set wrong source field in content_translation
π©πͺGermany WalterP
WalterP β created an issue.
π©πͺGermany WalterP
WalterP β created an issue.
π©πͺGermany WalterP
Thank you for answering.
I solved the problem with a patch in the AugmentorBaseWidget.
I add the case for entity_reference_revisions type and pass the entity_id to the service:
foreach ($source_fields as $field_name) {
$field_type = $entity->get($field_name)->getFieldDefinition()->getType();
$nid = $entity->id();
if (!$entity->get($field_name)->isEmpty()) {
$values = $entity->get($field_name)->getValue();
foreach ($values as $value) {
switch ($field_type) {
case 'image':
case 'entity_reference_revisions':
$value = strval($nid);
break;
And in the service I load the entity and get the paragraphs field values and process them.
π©πͺGermany WalterP
WalterP β created an issue.