This function is intended to be used within THEMENAME_preprocess_node()
(or, well, any template_preprocess_node()
implementation). It parses the field collection render array and gives you direct access to the render arrays of the individual deltas. They are normally buried in a few layers of arrays and normally require you to look up the field collection item ID/revision yourself first. Often, you simply want to iterate over them and don't care about their IDs. This helper function helps solve that problem.
You pass it the $variables
array and the field names of the Field Collection fields that are attached to the node and that you want to massage. It adds variables to the $variables
array, named after the field + _indexed
.
So if you call THEMENAME_massage_field_collections($variables, array('field_my_field_collection');
, $variables['field_my_field_collection']
will exist after it's done.
It also adds a #value
and #revision_id
property to the variable it creates, just in case you need t