| 1 |
<?php |
<?php |
| 2 |
// $Id: taxonomy_image_node_display.module,v 1.1.4.15 2009/03/15 17:43:50 nancyw Exp $ |
// $Id: taxonomy_image_node_display.module,v 1.1.4.16 2009/03/16 00:07:11 nancyw Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 116 |
$preset = $preset; |
$preset = $preset; |
| 117 |
$valid_nodes = array_filter($view); |
$valid_nodes = array_filter($view); |
| 118 |
if (isset($valid_nodes[$node->type]) && isset($node->taxonomy)) { |
if (isset($valid_nodes[$node->type]) && isset($node->taxonomy)) { |
| 119 |
$images = NULL; |
$images = array(); |
| 120 |
foreach ($node->taxonomy as $tid => $term) { |
foreach ($node->taxonomy as $tid => $term) { |
| 121 |
$image = taxonomy_image_display($tid, NULL, $preset, array('wrapper' => FALSE)); |
$image = taxonomy_image_display($tid, NULL, $preset, array('wrapper' => FALSE)); |
| 122 |
if ($view_link && $image) { |
if ($view_link && $image) { |
| 123 |
$image = theme('taxonomy_image_display', $image, $term); |
$image = theme('taxonomy_image_display', $image, $term); |
| 124 |
} |
} |
| 125 |
$images .= $image; |
$images[] = $image; |
| 126 |
} |
} |
| 127 |
$node->content['taxonomy_image'] = array( |
$node->content['taxonomy_image'] = array( |
| 128 |
'#value' => $images, |
'#value' => theme('taxonomy_image_display_images', $images), |
| 129 |
'#weight' => variable_get('taxonomy_image_node_view_weight', -5), |
'#weight' => variable_get('taxonomy_image_node_view_weight', -5), |
| 130 |
); |
); |
|
if (!$view_link) { |
|
|
$node->content['taxonomy_image']['#prefix'] = '<div class="taxonomy-images">'; |
|
|
$node->content['taxonomy_image']['#suffix'] = '</div>'; |
|
|
} |
|
| 131 |
} |
} |
| 132 |
} |
} |
| 133 |
} |
} |
| 140 |
'taxonomy_image_display' => array( |
'taxonomy_image_display' => array( |
| 141 |
'arguments' => array('image', 'term'), |
'arguments' => array('image', 'term'), |
| 142 |
), |
), |
| 143 |
|
'taxonomy_image_display_images' => array( |
| 144 |
|
'arguments' => array('images'), |
| 145 |
|
), |
| 146 |
); |
); |
| 147 |
} |
} |
| 148 |
|
|
| 153 |
$name = variable_get('taxonomy_image_node_show_name', TRUE) ? taxonomy_image_tt("taxonomy:term:$term->tid:name", $term->name) : NULL; |
$name = variable_get('taxonomy_image_node_show_name', TRUE) ? taxonomy_image_tt("taxonomy:term:$term->tid:name", $term->name) : NULL; |
| 154 |
return l($image, 'taxonomy/term/'. $term->tid, array('html' => TRUE, 'attributes' => array('class' => 'taxonomy-image-links'))) . $name; |
return l($image, 'taxonomy/term/'. $term->tid, array('html' => TRUE, 'attributes' => array('class' => 'taxonomy-image-links'))) . $name; |
| 155 |
} |
} |
| 156 |
|
|
| 157 |
|
function theme_taxonomy_image_display_images($images) { |
| 158 |
|
if (!is_array($images) || count($images) == 0) |
| 159 |
|
return NULL; |
| 160 |
|
|
| 161 |
|
$output = '<div class="taxonomy-images">'; |
| 162 |
|
$output .= implode('', $images); |
| 163 |
|
$output .= '</div>'; |
| 164 |
|
return $output; |
| 165 |
|
} |