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.
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
Comment #2
jmuzz CreditAttribution: jmuzz commentedHi @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?
Comment #3
mattf100 CreditAttribution: mattf100 commentedThanks 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!
Comment #4
mattf100 CreditAttribution: mattf100 commentedProblem 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.
Comment #5
atul4drupal CreditAttribution: atul4drupal commentedUpdated 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
Comment #6
mattf100 CreditAttribution: mattf100 commentedIssue still exists (see comments). The bug was marked as Postponed, now updated to Active for maintainer to have another look.
Comment #7
PierreV CreditAttribution: PierreV commentedI 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.
Comment #8
iMiksuI'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.
Comment #9
schifazl CreditAttribution: schifazl commentedI 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.
Comment #10
AndyThornton CreditAttribution: AndyThornton commentedThere 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.
Comment #11
james.williams CreditAttribution: james.williams at ComputerMinds commentedSee #2942188: Field collections on old revisions get deleted - a patch is there too.
Comment #12
james.williams CreditAttribution: james.williams at ComputerMinds commentedI'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.