Thematic assembly of fields in drupal 7 node pages

Drupal 7 field collection "- If I want to use a node theme that has a" field collection ", how do I deal with field separation for customization? It seems that so far only print render ($ content ['field_collection_name']); prints the result. Problem in that I can’t understand how to isolate fields for topics.

I created a node for this purpose - content_type.tpl.php, but now I'm stuck in the water. It would be very appreciated that someone saved my day.

Solved the following:

Some of the links below are really very useful, so look, however, I did something like this - Enter dsm(print_r($variables)); in node for display in my case node--content_type.tpl.php using a collection of fields to find out the necessary arrays and field values ​​and then hide, of course.

Then part of the style 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>

+4
source share
3 answers

There's a pretty good talk about what's going on here:

http://drupal.org/node/1155752

The main answer is the theme with the template field - your-field-collection-name.tpl.php

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

+4
source

You can create a custom field polisher for your field and use this formatter to customize your content type.

The field filter gives full control over html output before it is submitted to the node template.

You can use this great tutorial to create a custom field polisher: http://www.computerminds.co.uk/articles/creating-new-field-formatters-drupal-7

+2
source

For a more normal use of template-based templates, try the patch at http://drupal.org/node/1187990 . Hope this goes in Field Collection 2.x.

+1
source

All Articles