Hi,

I am getting the following error when I try to save a translation for a node that has unlimited field collections:

Exception: The host entity cannot be changed. in FieldCollectionItemEntity->updateHostEntity() (line 384 of /var/www/mapr/sites/default/modules/field_collection/field_collection.module).

I have the following relevant modules enabled:

  • field_collection 7.x-1.0-beta5+1-dev (2013-Apr-12)
  • entity_translation 7.x-1.0-beta3+1-dev (2013-Jul-24)
  • i18n 7.x-1.9

With the following patches:

Steps to reproduce issue:

  1. Create content type with an unlimited collection field
  2. Create a node in language 1 (Ex. English)
  3. Click on translate, modify content for language 2 (Ex. Spanish) and hit save

Notes:

  • When I click on translate all the field values from the other language come pre-filled, including those of the field collection.
  • If I click on 'eliminate' for each field collection, add them again for the translation and click save, there are no errors.

I believe this might have something to do with the translation's field collections still referencing the IDs for the other field collections in the original node. I am trying to find the code that pre-fills the field collection values for the translation to verify my hypothesis. Any help is greatly appreciated.

Comments

ghalenir’s picture

I am also using same versions and I had same problem. I tried to debug it and found that there is some problem with FC

/**
* FAPI validation of an individual field collection element.
*/
function field_collection_field_widget_embed_validate($element, &$form_state, $complete_form) {

if (isset($field_state['entity'][$element['#delta']])) {
$field_collection_item = $field_state['entity'][$element['#delta']];
}
elseif ($form_state['values'][$field_state['array_parents'][0]][$field_state['array_parents'][1]][$element['#delta']]) {
if(isset($field_state['entity'][0]))
{
$field_collection_item = clone $field_state['entity'][0];
}
else
{
I added my custom code here and fixed the issue
}

I don't know if this is a problem with FC or ET

ghalenir’s picture

I am also having another issue. After translating content when I change the language from drop down and tried to view in different language I don't see the content in different language and if I tried to edit the page it goes to es/node/239/edit and this edit page doesn't give me the content in spanish language. Its working in previous version but not in this Dev version.

plach’s picture

plach’s picture

Status: Active » Closed (won't fix)