Steps to reproduce the bug:
1) Enable i18n in order to have a translatable content type (node_type_example)
2) Configure a field collection (field_data_field_collection) with a node reference field (field_data_field_collection_noderef)
3) Add this field collection to the content type
4) Create a new node, set it to "english" and add another node (english) as reference in the field collection node reference sub field (field_data_field_collection_noderef).

The language field in the entity field table (field_data_field_collection) is "en", instead the language field in the node reference sub field (field_data_field_collection_noderef) is "und".

5) The last step is to translate the node, for example in german.

At this point There are two errors:

Notice: Undefined index: nid in node_reference_field_prepare_translation() (line 883 of /var/www/sites/all/modules/references/node_reference/node_reference.module).
Notice: Trying to get property of non-object in node_reference_field_prepare_translation() (line 887 of /var/www/sites/all/modules/references/node_reference/node_reference.module).

The field_data_field_collection table contains two records (it's what I'd expect), "en" and "de", but both have the same value which refers to the field_data_field_collection_noderef table which contains only the "und" record, shared between the translations.

Moreover there is a side effect: when you delete one of the two nodes the field_data_field_collection_noderef record is deleted. This will trigger more errors on the other node because field collections doesn't find any matching records.

CommentFileSizeAuthor
#8 MARWEB-164-testcase.png65.76 KBzilverdistel
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

skolesnyk’s picture

I confirm that. Please, fix.

FiNeX’s picture

I've just read a note on the README.txt about the restrictions on using this module with i18n:

* As of now, the field-collection field does not properly respect different
revisions or languages of the host entity. Thus, for now it is suggested to
only use the field for entities that are not revisionable and translatable.

:-(

Cyberwolf’s picture

Subscribing.

timme77’s picture

Subscribing.

remaye’s picture

Subscribing.

Refineo’s picture

subscribe

zilverdistel’s picture

I believe there are multiple bugs at play here. I carefully followed the steps you described (with a fresh content type) (plus installing the necessary modules) on a vanilla install, but I did not get the notices. I checked the language fields in the tables, and they were both "und".

I have the issue (the notices) on a "not so vanilla" install and willing to solve it, but I'm first trying to reproduce this on a vanilla install.

zilverdistel’s picture

FileSize
65.76 KB

I'm having the "delete" issue with a field collection without node references also.

There's an image of my (Selenium) test case in attachment ..

The node type I use is Translatable with collection. The included collection has one textfield: twc-coll-textfield.

I created a seperate issue for this: http://drupal.org/node/1315432.

c4rl’s picture

Related 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.

gingic’s picture

I am using the the node referencing inside an article content type.

The article which is being used uses the Internationalization (i18n) module for content translation.

The error message occurs when I am trying to click on translate link in order to write the German version of the article:

Notice: Undefined index: nid in node_reference_field_prepare_translation() (line 883 of /var/www/sites/all/modules/references/node_reference/node_reference.module).
Notice: Trying to get property of non-object in node_reference_field_prepare_translation() (line 887 of /var/www/sites/all/modules/references/node_reference/node_reference.module).

mgifford’s picture

Issue tags: +i18n compatibility

Tagging

jmuzz’s picture

Status: Active » Closed (duplicate)

I believe the issues mentioned here were solved by the resolution of #1316162: Support content translation and host entity cloning. New copies of the data were not getting created and every translation of the node referenced the same field collection item.