CCK Formatters for Content Taxonomy
mongolito404 - July 29, 2009 - 13:32
| Project: | Taxonomy Image |
| Version: | 6.x-1.6 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Jump to:
Description
Hi,
The Content Taxonomy module defines a field type for taxonomy terms. Here is a simple module that provides formatters using Taxonomy Image for this type. Formatters are provided for the ORIGINAL profile and available ImageCache presets.
| Attachment | Size |
|---|---|
| content_taxonomy_image.zip | 1008 bytes |

#1
Thanks for creating this
#2
works as expected
+1 for including this as a contribution
one feature might need to be added though
when image does not exist for a term the regular text link should be displayed (current implementation shows nothing)
#3
If you need to display image + text link then replace following function
<?phpfunction theme_content_taxonomy_image_formatter($element){
if (!empty($element['#item']['value'])) {
$term = taxonomy_image_get_object($element['#item']['value']);
_content_taxonomy_localize_term($term);
$tname = " ". taxonomy_image_tt("taxonomy:term:$term->tid:name", $term->name);
return l(taxonomy_image_display($term->tid, NULL, $element['#formatter'], array('wrapper' => FALSE)).$tname, 'taxonomy/term/' . $term->tid, array('html'=>TRUE));
}
}
?>
It also solves problem with terms with no image from being displayed
#4
This is so great! Thank you!