function taxonomy_image_handler_field_allterms in Taxonomy Image 5
Display all the terms for a given vocabulary
1 string reference to 'taxonomy_image_handler_field_allterms'
- taxonomy_image_views_tables_alter in ./
taxonomy_image.module - This module is a small helper module to fix an issue with a view.
File
- ./
taxonomy_image.module, line 780 - taxonomy_image.module Simple module for providing an association between taxonomy terms and images. Written by Jeremy Andrews <jeremy@kerneltrap.org>, May 2004.
Code
function taxonomy_image_handler_field_allterms($fieldinfo, $fielddata, $value, $data) {
if ($fieldinfo['vocabulary']) {
$terms = taxonomy_node_get_terms_by_vocabulary($data->nid, $fieldinfo['vocabulary']);
}
else {
$terms = taxonomy_node_get_terms($data->nid);
}
switch ($fielddata['options']) {
case 'nolink':
$links = array();
foreach ($terms as $tid => $term) {
$links[] = check_plain($term->name);
}
$links = !empty($links) ? implode(' | ', $links) : '';
break;
case 'image':
// load node to get type which is needed by taxonomy_image_link_alter to check that the type is activated to replace links by images.
$node = node_load($data->nid);
// copy terms, but should not be needed
$node->taxonomy = $terms;
// taxonomy_image_link_alter will hook on the taxonomy_link call
$links = theme('links', taxonomy_link('taxonomy terms', $node));
break;
case 'imagenolink':
$links = array();
foreach ($terms as $tid => $term) {
$links[] = taxonomy_image_display($tid, NULL, NULL, array(
'wrapper' => FALSE,
));
}
$links = implode(' ', $links);
break;
default:
$node = new stdClass();
$node->taxonomy = $terms;
$links = theme('links', taxonomy_link('taxonomy terms', $node));
}
return $links;
}