Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Luke_Nuke on
I'm rendering a field from a taxonomy term in node.tpl.php
if($term = taxonomy_term_load($node->field_test['und'][0]['tid'])) {
$image_field = field_view_field('taxonomy_term', $term, 'field_image');
print render($image_field);
}
But the problem is that above code doesn't apply style to image (from "manage display" tab of term). I discovered how to do it - by adding an empty string as additional parameter to field_view_field - then automagically style will start to apply to rendered content, but the question is - is it normal? This look very strange as I thought that style should be applied by default and it looks kinda buggy.
Comments
The fourth argument
I added a fourth argument 'image' for the field_view_field:
$image_field = field_view_field('taxonomy_term',$term,'field_image','image');
It render only the image as you specified for the field cck, even you hidden the label and description.
Worked great for me - thanks!
Worked great for me - thanks!