Wednesday, 31 January 2018

Output Field Collection Fileds In node.tpl.php

Hello Drupaler, Essay way to render multiple field collection field without any error and notice.

$t = count($node->field_collection_name_collection['und']);
for ($i = 0; $i <= $t-1; $i++) {
  $field_collection = entity_load('field_collection_item', array($node->field_collection_name_collection['und'][$i]['value']));
     foreach ($field_collection as $value) {
          print  "<h1>".$value->field_collection_name_title['und'][0]['value']. "</h1>";
          print  $value->field_collection_name_body['und'][0]['value'];
      }
}

No comments:

Post a Comment