Taxonomy images div is rendered even when there is no taxonomy images for current node

pivica - June 28, 2009 - 15:21
Project:Taxonomy Image
Version:6.x-1.6
Component:Contrib Node Display
Category:bug report
Priority:minor
Assigned:Unassigned
Status:active
Description

taxonomy_image_node_display.module line 125 should be changed from this

120:      foreach ($node->taxonomy as $tid => $term) {
121:        $image = taxonomy_image_display($tid, NULL, $preset, array('wrapper' => FALSE));
122:        if ($view_link && $image) {
123:          $image = theme('taxonomy_image_display', $image, $term);
124:        }
125:        $images[] = $image;
126:      }

to this

120:      foreach ($node->taxonomy as $tid => $term) {
121:        $image = taxonomy_image_display($tid, NULL, $preset, array('wrapper' => FALSE));
122:        if ($view_link && $image) {
123:          $image = theme('taxonomy_image_display', $image, $term);
124:          $images[] = $image;
125:        }
126:      }

Why? Whit current code in situation when node has taxonomies but that taxonomies don't have images $images array will have elements with empty strings. Because of that theme_taxonomy_image_display_images will render taxonomy-images div which is empty. Whit proposed change taxonomy_image will work as expected in this special cases.

 
 

Drupal is a registered trademark of Dries Buytaert.