Skip to content

Instantly share code, notes, and snippets.

@johnmcc
Created November 1, 2012 09:15
Show Gist options
  • Save johnmcc/3992655 to your computer and use it in GitHub Desktop.
Save johnmcc/3992655 to your computer and use it in GitHub Desktop.
Loading field collections as entities from Drupal templates
<?php
foreach($content['field_my_field_collection']['#items'] as $entity_uri) {
$item = entity_load('field_collection_item', $entity_uri);
foreach ($item as $entity_obj) {
dpm($entity_obj->field_my_individual_field);
}
}
?>
@johnmcc
Copy link
Author

johnmcc commented Jan 15, 2013

Change 'field_my_field_collection' to the name of your field. Leave 'field_collection_item' as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment