How would I go about looping through collections with this module via php?

example, I have a collection with a file (that I need the url to?), a title and a drop down with a few values and I just want to make output based on their grouping, so I would have:
{
title: $title
path: $url_to_file
category:$drop_down_value
}{
title: $title2
path: $url_to_file2
category:$drop_down_value2
}etc...

Comments

iangrigiani’s picture

subscribe

patchshorts’s picture

sub

guybedford’s picture

I don't know if it helps or not, but the way for loading field collections with entity_load on a node template is described here: http://drupal.org/node/1294536#comment-5362592

jmuzz’s picture

Issue summary: View changes
Status: Active » Fixed

That's really all there is to it. The ID of each field collection entity is stored in the field in the node, and once you have the entity you can access its fields the same way you access the fields in a node.

It may be better to use entity metadata wrappers instead of raw entities.

https://drupal.org/node/1021556

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.