After recent upgrade to 7.x-1.0-beta12, values no longer appear on the field collection fields on the edit node form. The values are still showing when viewing the node.

All nodes show updated date equal to when the module was upgraded, so it appears something in the new version or the db update has caused this.

Comments

mattf100 created an issue. See original summary.

jmuzz’s picture

Status: Active » Postponed (maintainer needs more info)

Hi @mattf100,

are you using entity translation on your site? The update attempts to copy field collection data into it's hosts translations to set up the new support for the feature, and I'm guessing the update is causing this problem.

If so, can you tell me more about your translation setup? Was entity translation turned on for the field collection item entity type? Were the affected field collection fields set to be translatable? Were the inner fields of the collection set to be translatable?

mattf100’s picture

Thanks for pointing me in the right direction. Yes, the site uses entity translation (7.x-1.0-beta5). Yes, the nodes in question are translatable, as were the individual fields within the field collection. However, translation was not enabled for the field collection entity type. I have enabled it, it ran the migration, and now the values appear.

Many thanks!

mattf100’s picture

Problem still exists when adding new content. Was able to save a new node of the content type containing the field set, but when the edit form reloaded, the values were missing like before. I added the values back, saved the edit form again, and this time the values showed on the form.

This only happens to the field set entity that wasn't originally set to be translatable (there is a second field set on the same node that works correctly). So it appears something isn't quite right when inserting the data, but updates are ok.

atul4drupal’s picture

Updated FC to 7.x-1.0-beta12
Did anyone found a solution to the problem, we too were faced with the same scenario,
After node creation when we edit the node we do not see the field collection items, though these are appearing in node view page.

On adding the value again in edit form and saving, they start appearing in edit form hence forth.

1) Was entity translation turned on for the field collection item entity type - YES
2) Were the affected field collection fields set to be translatable? - YES
3) Were the inner fields of the collection set to be translatable? - YES

mattf100’s picture

Status: Postponed (maintainer needs more info) » Active

Issue still exists (see comments). The bug was marked as Postponed, now updated to Active for maintainer to have another look.

PierreV’s picture

I had the same problem : the node was set to the language "fr" but there was no "fr" field in the field collection items (only "und").
The only way to make this work was to copy the "und" field to "fr" programmatically, with a little script.

iMiksu’s picture

Priority: Normal » Critical

I've confirmed one of my projects, that update 7008 causes data loss if you don't have language neutral values. Therefore I'm marking this as critical.

In our case, all the parent nodes that has field collection fields (that have values), loses title value from the parent node.

schifazl’s picture

Title: No values on edit form » Update 7008 overwrites existing translations

I confirm too that update 7008 causes data loss!

I have a content type with a unlimited value field collection. The field collection's title is translatable (I'm using title field module) and after the update all the titles are gone.

AndyThornton’s picture

There are certainly some very fishy things with 7008. I think the logic might be wrong (maybe that goes without saying). My scenario isn't quite the same as that stated above. We have Entity Translation enabled, but none of my field collections are translatable. There are fields within the field collection that are translatable, though. We didnt mark our field collections as translatable, because it never seemed to work properly. The problem seems very similar to that reported, though. When I run this update and then go into a field collection I see missing data (it is still in the DB, it is just not associated with the right language).

The code in field_collection_update_7008 queries all fields that are translatable and participate in an field collection. It then gets the field collection item entity and calls copyTranslation on them.

It is hard to tell the intent of the original developer, but it seems that perhaps that 'translatable' check is in the wrong place (at least for my scenario). I am going to try to tweak it locally and will write back if I make any progress.

james.williams’s picture

james.williams’s picture

I've also seen sites that use Lingotek run into data loss with this update, because Lingotek 'takes over' translation handling for field collections in some places, ensuring that they have data under specific language values, rather than language neutral. But the field collection update 7008 assumes other modules haven't monkeyed with how it expects values to be stored.