I'm running into a problem of programmatically checking fields in a field collection.
What I want to do is loop through all fields within a field collection and check which ones are required.
I've tried these codes so far but haven't got any positive results.
$collections = field_collection_item_load_multiple($collection_ids);
foreach ($collections as $collection) {
foreach($collection as $key => $va) {
if (strpos ($key, 'field') !== false) {
if (isset($va['und']) && is_array($va ['und']) && isset($va['und'][0]['value'])) {
print "Field ".$key." ".$va['und'][0]['value'];
}
}
}
}
This shows me the data and the label of the fields, not really their properties.
Thank you for your help.