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.
When an entity is loaded that contains field collections, how can you have all the field collection entities loaded into the host entity instead of just their item IDs? Is there a quick workaround I can add to my entity load functions (inside Entity API)?
Comments
Comment #1
etibmw CreditAttribution: etibmw commentedhey kevinquillen,
i am facing the same problem, did you get this to work?
any help will be grate
eti
Comment #2
jmuzz CreditAttribution: jmuzz commentedI wouldn't say there is a quick solution, but it is possible. Depending on how general you need it to be you can load code it to load the fields you know are field collections or you can use the values in the field_config table or use the Field Info API to determine which fields are field collections and then load them into the field data. The module already does something like this to handle the creation of Field Collection Items in the embedded form so it should be pretty harmless, just don't replace the 'value' or 'revision_id' with the entity but make your own name for it like 'loaded_entity' .