Skip to main content
2 of 2
Improving for additional info.
kenorb
  • 14.3k
  • 10
  • 98
  • 168

By this way as per this post:

/**
 * Implementation of hook_node_presave.
 */
function mymodule_node_presave($node) {
  if ($node -> type == 'my_type') {
    $field_field_collection = field_get_items('node', $node, 'field_field_collection');
    foreach ($field_field_collection as $key => $value) {
      $fc_wrapper = entity_metadata_wrapper('field_collection_item', $value['entity']);
      $fc_name = $fc_wrapper -> field_field_collection_name -> value();
      dsm($fc_name);
    }
  }
}

See: Understanding Field Collection Values and Entity metadata wrappers pages.

masdzen
  • 129
  • 7