Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
1) Create a content type with a repeating field collection
2) Enable translations
3) Add content in the field collection in a node
4) Translate the node
Expected: The new node has the same field collections data as the parent node
Actual: No field collection data is copied to the new node
Comments
Comment #1
cjgriffin CreditAttribution: cjgriffin commentedI've run into an issue that could be related. I built a site, and field collection functionality was working perfectly. I enable i18n modules and started working on a translation, and the field collection (subform) widget no longer saves any data. No new field collection entities are created (in either language)... nothing is saved to the database. This is critical for a project due very soon, so I'll try and come up with a solution, though I may have to go a different route if I can't figure it out quick enough.
Comment #2
cjgriffin CreditAttribution: cjgriffin commentedFurther investigation: Only the widget included in the patch in http://drupal.org/node/977890#comment-4237396 has the i18n issue for me. If I create a field collection the normal way it saves and shows up in both languages.
Comment #3
tko CreditAttribution: tko commentedHaving the similar issue as OP.
1) Add new node
2) Add couple of field collections to said node
3) Translate node into another language
4) Open translated node and it has no field collections
I realise we can turn on 'language sync' on the collection field in the content type but then it does not become translatable.
What is the best way of making a field collection translatable? I'm guessing this is mainly a widget problem? If the widget appeared inline with the node entry fields then when you translated a node, you could also do the collection at the same time.
Any solution for this?
Comment #4
Jerome F CreditAttribution: Jerome F commentedI tested the patch in http://drupal.org/node/977890#comment-4564324 with content translation - the result is here.
I think that's normal, as this module is at its early beginning, i18n is not aware of it. But I tried to translate a page with field collections with content translation, for curiosity's sake.
Just for your information, the result is, on a content translation edit page, with an embedded widget, if you clic the add button you receive the following:
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /fr/system/ajax
StatusText: Service unavailable (with message)
ReponseText: Recoverable fatal error : Argument 1 passed to field_collection_item_is_empty() must be an instance of FieldCollectionItemEntity, null given, called in (...)/sites/all/modules/field_collection/field_collection.module on line 887 and defined in field_collection_item_is_empty() (line 552 in (...)/sites/all/modules/field_collection/field_collection.module).
That confirms that field collection translation doesn't exist in Drupal 7 yet.
If you save the translation:
Notice : Undefined index: field in field_widget_field() (line 521 in (...)/modules/field/field.form.inc).
Notice : Undefined index: instance in field_widget_instance() (line 546 in (...)/modules/field/field.form.inc).
Notice : Undefined index: field in field_widget_field() (line 521 in (...)/modules/field/field.form.inc).
Notice : Undefined index: instance in field_widget_instance() (line 546 in (...)/modules/field/field.form.inc).
Notice : Undefined index: field in field_widget_field() (line 521 in (...)/modules/field/field.form.inc).
Notice : Undefined index: instance in field_widget_instance() (line 546 in (...)/modules/field/field.form.inc).
Notice : Undefined index: entity in field_collection_field_widget_embed_validate() (line 881 in (...)/sites/all/modules/field_collection/field_collection.module).
Notice : Trying to get property of non-object in entity_extract_ids() (line 7368 in (...)/includes/common.inc).
Notice : Undefined index: field_name in _field_invoke() (line 188 in (...)/modules/field/field.attach.inc).
Notice : Undefined index: field_name in _field_invoke() (line 188 in (...)/modules/field/field.attach.inc).
Notice : Trying to get property of non-object in entity_extract_ids() (line 7368 in (...)/includes/common.inc).
Notice : Undefined index: field_name in _field_invoke() (line 188 in (...)/modules/field/field.attach.inc).
Notice : Undefined index: field_name in _field_invoke() (line 188 in (...)/modules/field/field.attach.inc).
Notice : Trying to get property of non-object in entity_extract_ids() (line 7368 in (...)/includes/common.inc).
Notice : Undefined index: field_name in _field_invoke() (line 188 in (...)/modules/field/field.attach.inc).
Notice : Undefined index: field_name in _field_invoke() (line 188 in (...)/modules/field/field.attach.inc).
Recoverable fatal error : Argument 1 passed to field_collection_item_is_empty() must be an instance of FieldCollectionItemEntity, null given, called in (...)/sites/all/modules/field_collection/field_collection.module on line 887 and defined in field_collection_item_is_empty() (line 552 in (...)/sites/all/modules/field_collection/field_collection.module).
So nothing to worry about until this module is released and taken into account by i18n's team. Yet I don't know if it's possible to simplify i18n's team future work during the actual module development.
Comment #5
FiNeX CreditAttribution: FiNeX commentedI've got a similar error creating a node (which has some field collections in it) with i18n and content translation enabled :-(
I'm using the latest -dev of i18n and field_collection and entity API 7.x-1.0-beta8.
Comment #6
designar CreditAttribution: designar commentedAny news for that issue? (mainly with Field Translation enabled)
Comment #7
FiNeX CreditAttribution: FiNeX commentedIt looks that field_collections doesn't support i18n: http://drupal.org/node/1186878#comment-4625730
:-(
Comment #8
TommyChrisI tried to use field collection in profile fields. My site is multilingual. How can I 'turn off' the profile translation?
Comment #9
TommyChrisI investigated the code, and found a mislogic. My php error disappeared and it looks good, but the warnings not.
field_collection.module at line 892
should be
The params are swapped.
Comment #10
jox CreditAttribution: jox commentedHere the problem appears as soon the 'Field translation' module is activated. Even on content types with translation turned off. As soon a record is saved the following messages are shown and nothing is stored.
If 'Field translation' is turned off ('Internationalization' and 'Multilingual content' still on) it works fine.
Comment #11
jox CreditAttribution: jox commentedI did some debugging and found a bug in i18n_field. I reported it with a patch to the Internationalization project: #1197866: $form_state does not get passed correctly in i18n_field_field_widget_form().
This fixes my problem. I'm not sure if all other issues in this thread are also fixed with this.
Comment #12
c4rl CreditAttribution: c4rl commentedRelated to this issue: I've created a feature request for translation support #1316162: Support content translation and host entity cloning
I'm not certain whether the feature request encompasses this particular issue fully so I'll leave as-is for now. Feel free to mark this issue as duplicate or close.
Comment #13
Frederic wbase CreditAttribution: Frederic wbase commentedNumber for also solved the problem for me, thanks for the work!
grts
frederic
Comment #14
ywarnier CreditAttribution: ywarnier commentedAs a quick patch, I have done the following changes to my field_collection.module as follows because these lines used to trigger warnings which were breaking the saving process for nodes using field collections. Afaik this patch doesn't have side-effects on my nodes creations.
then on line 1253 (this also used to trigger errors)
I'm not submitting as a patch because I have no idea what these two changes might involve, but it seemed to me that was basic values validation and it shouldn't even have popped up as a warning in the first place.
Please feel free to comment and maybe (in the end) apply as a patch. I need a more insightful opinion to know if this is alright or if I just flung open the doors to hell.
Comment #15
klonosI think this bug is only valid when node (content) translation is used - not with field (entity) translation. If so, it should clearly be stated in the issue's summary.
Comment #16
chaskype CreditAttribution: chaskype commentedIt happens the same
When I put translation is updated in both cases (Spanish/English)
Someone could solve this problem?
Comment #17
joel_osc CreditAttribution: joel_osc commentedSorry for late reply, but for anyone else seeing this issue see: #1316162: Support content translation and host entity cloning
Comment #18
jmuzz CreditAttribution: jmuzz commentedContent translation was not supported when this issue was opened but it has since been added.