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
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.

AttachmentSize
content_taxonomy_image.zip1008 bytes

#1

animelion - September 19, 2009 - 12:55

Thanks for creating this

#2

GiorgosK - September 21, 2009 - 09:25

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

GiorgosK - September 27, 2009 - 08:07

If you need to display image + text link then replace following function

<?php
function 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

xqbzzr - December 4, 2009 - 21:19

This is so great! Thank you!

 
 

Drupal is a registered trademark of Dries Buytaert.