With the field collection module for example, if using nested field collection, one will get a crash trying to save the translation if the parent field collection for the source entity has more than one item. This is caused by field collection calling field_widget_field in form validation, and since the $form_state (including field state) of the translation corresponds to an empty entity form (with the one default item), the information is missing. What needs to be done is to convert the field state (at least the 'fields' field state), from the source form, and inject it into the current form state as outlined in this patch. It's not a perfect fix (if you happen to have a field name with the same name as a language prefix, you are in trouble), but it should be safe enough. Other suggestions are welcome, but this solution/workaround is at least pretty compact.

Comments

gnucifer created an issue. See original summary.

gnucifer’s picture

gnucifer’s picture

Title: Invalid field state causes subtle bug when copying multiple fields » Invalid field state causes subtle bug when copying nested fields
gnucifer’s picture

Issue summary: View changes
gnucifer’s picture

Issue summary: View changes
gnucifer’s picture

Title: Invalid field state causes subtle bug when copying nested fields » Invalid field state causes crash when copying nested fields
gnucifer’s picture

Oh, just realized this is probably a duplicate of https://www.drupal.org/node/2339315.

gnucifer’s picture

Status: Needs review » Closed (duplicate)