0

I'm using the following code to return array of all field collection IDs for a node's field collection. How do I use these IDs to get an array of the values of the fields within the field collection?

case 'field_collected_dates':
$fid = field_get_items('node', $node, $key, $node->language);
$return[ $key_clean ] =  $fid;
break;

1 Answer 1

-1

this is how you can get values from field collection

if(isset($node->field_field_collection['und'])) {
  foreach($node->field_field_collection['und'] as $field){
    $colection_node = entity_load('field_collection_item', array($field['value']));
    $name_from_collection = $colection_node[$field['value']]->field_field_name['und'][0]['value'];
  }
}

now you can understand how to get value from field collection try to fix this in your code

THANKS

1
  • this does not answer my original question: "Get Field Collection Array From Field Collection ID"
    – Sam
    Commented Nov 21, 2017 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.