Theming “field collection” in node pages drupal 7

collectionsdrupaldrupal-7drupal-themingfield

Drupal 7 "field collection" – If I want to theme a node page which has a "field collection", how do I go about separating the fields for customization? It seems thus far that only print render($content['field_collection_name']); outputs the result. The problem is that I can't figure out how to isolate the fields for theming.

I've created a node–content_type.tpl.php for this purpose but now stuck dead in the water. Would really appreciate someone saving the day for me.

Solved as follows:

Some of the links from below are really very helpful so do look, though, I've done something like this –
Enter dsm(print_r($variables));on node to be rendered in my case node--content_type.tpl.php with field collection to find out the arrays and field values needed, then hide of course.

The styling part then would look something like this

<div>class="class-for-label-here">My Desired Label - <span class="my-field-class-here"><?php print render($content['my_desired_field_here']['#items'][0]['value']); ?></span></div>

Best Answer

There's a fairly good conversation about this same thing going on here:

http://drupal.org/node/1155752

Main answer is theming with template field--your-field-collection-name.tpl.php

After that you just need to figure out how to retrieve the contents from the arrays and/or objects!

Related Topic