Active
Project:
Entity Translation
Version:
7.x-1.0-beta3
Component:
Base system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Jun 2014 at 20:44 UTC
Updated:
13 Jun 2014 at 16:55 UTC
Jump to comment: Most recent
Comments
Comment #1
pbuyle commentedComment #2
pbuyle commentedDebugging the issue, I've found that, if a child entity has been created in the inline entity form, in the call
EntityTranslationDefaultHandler::updateTranslations()fromentity_translation_field_attach_update(),$langcodeis set to the edited translation language and$this->isTranslating()is false, soEntityTranslationDefaultHandler::setOriginalLanguage()is called. This remove the original language translation from the handler's owntranslationsdata structure. Which later replace the translations stored in the database.However, when a child entity has not been created in the inline entity form
$langcodeis the original translation's language. So the call toEntityTranslationDefaultHandler::setOriginalLanguage()does not remove the original translation.Next step is to identify what causes the
$langcodeto have the wrong value.Comment #3
pbuyle commentedWhen a child entity has been created from the edit form for the translation of the parent, in
EntityTranslationDefaultHandler::updateFormLanguage,$form_state['values']['language']is set to the edited translation language. If a child entity has not been created,$form_state['values']['language']is set to the original translation language.Comment #4
pbuyle commentedI tried applying the patch #1865244: Allow multiple translation handlers on the same form but it does not help (actually, that's the first thing Itried and I've continued working with the patch applied).
Comment #5
pbuyle commentedWhen the child entity creation form embedded in the edit form for the translation of the parent entity is submitted,
EntityTranslationDefaultHandler::entityFormLanguageWidget()is called twice on the same$form. The first time for the parent entity, the second time for the child entity. Off course, the second time the method is called, the child entity is new and is not a translation.The first call to
EntityTranslationDefaultHandler::entityFormLanguageWidget()creates$form['language']as a select element whose default value is the language of the original translation of the parent entity. The second call toEntityTranslationDefaultHandler::entityFormLanguageWidget()resets$form['language']to a new select element whose default value is the language of the child entity.The easiest fix is to not enabled translation of the child entity type.
Comment #6
pbuyle commentedThe issue happens when the translation is enabled for the child entity type.
Comment #7
pbuyle commentedComment #8
pbuyle commentedI have multiple translation handler on the same form. They both add a language selector to the form, with the same key. So the second handler ends up overriding the first handler's language selector.