hook_node

Making field collections play nice with hook_node_presave

Field Collections are basically multifields in Drupal 7. They're so much user-friendlier than having referenced nodes, and so much lighter. However, if you try to add items to them (that is, an unlimited field collection field) in hook_node_presave , you get stuck in an endless loop. If you have XDebug or similar, you will see the extremely unhelpful message " Maximum function nesting level of '100' reached, aborting!". So what now?