AI Translate removes paragraphs with block content references and ignores global translation settings
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3535405. --> Reported by: [k.wiktorowicz](https://www.drupal.org/user/3710197) >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>When using AI Translate module to translate content that contains paragraphs with entity reference fields pointing to block content, two issues occur:<br> - Paragraphs are removed: The ReferenceFieldExtractor plugin incorrectly overwrites field values instead of preserving the original reference structure<br> - Global settings are ignored: The module ignores global configuration settings from /admin/config/ai/ai-translate/ where "Content block" is unchecked in "Entity reference translation" section</p> <h4 id="summary-steps-reproduce">Steps to reproduce (required for bugs, but not feature requests)</h4> <p>1. Install and configure AI Translate module<br> 2. Go to /admin/config/ai/ai-translate/<br> 3. In "Entity reference translation" section, ensure "Content block" is unchecked<br> 4. Create a content type with a paragraph field<br> 5. Create a paragraph type with an entity reference field pointing to block content<br> 6. Add content with a paragraph that references block content<br> 7. Use AI Translate to translate the content to another language<br> 8. Expected result:<br> - Paragraph with block content reference should be preserved in both original and translated content<br> - Block content should NOT be translated (as per global settings)<br> 9. Actual result:<br> - Paragraph with block content reference is removed from both original and translated content<br> - Block content gets translated despite being disabled in global settings</p> <h4>Technical details</h4> <p>Two issues in ReferenceFieldExtractor::setValue() method:<br> 1. Field value corruption: Code overwrites field values with entity objects instead of preserving original reference structure<br> 2. Missing validation: No checks for global translation settings (reference_defaults) before processing</p>
issue