0

This question already has an answer here:

I have created a content type and take field collection for some field. Within field collection I have taken 4 select box. Now I need to get these select box value in content type tpl file. For this I am using this code : $wrapper = entity_metadata_wrapper('node', $node_data);

but its not giving me select box option value.

marked as duplicate by Mołot, Shawn Conn, Scott Joudry, Yusef Mohamadi, Geoff Sep 23 '15 at 0:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

Use entity_load('field_collection_item', array($item_id)) or field_collection_field_get_entity($item)

Sample

$node = node_load($id);
$items = field_get_items('node', $node, 'field_fc');
foreach ($items as $item) {
$fc_value = field_collection_field_get_entity($item);
// Do something.
}

For reference link 1, link 2

1

Simple render the field on the node.tpl.php with field machine name:

print render($content['field_collection']);

It's work for me.

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