array( 'label' => t('As image'), 'field types' => array('content_taxonomy'), 'multiple values' => CONTENT_HANDLE_CORE, ), 'ORIGINAL_link' => array( 'label' => t('As image linked to term'), 'field types' => array('content_taxonomy'), 'multiple values' => CONTENT_HANDLE_CORE, ), ); if(function_exists('imagecache_presets')) { foreach (imagecache_presets() as $preset) { $formatters[$preset['presetname']] = array( 'label' => t('As @preset image', array('@preset' => $preset['presetname'])), 'field types' => array('content_taxonomy'), 'multiple values' => CONTENT_HANDLE_CORE, ); } foreach (imagecache_presets() as $preset) { $formatters[$preset['presetname'] .'_link'] = array( 'label' => t('As @preset image linked to term', array('@preset' => $preset['presetname'])), 'field types' => array('content_taxonomy'), 'multiple values' => CONTENT_HANDLE_CORE, ); } } return $formatters; } function content_taxonomy_image_theme() { $theme = array( 'content_taxonomy_image_formatter_ORIGINAL' => array( 'arguments' => array('element' => NULL, 'link' => FALSE), 'function' => 'theme_content_taxonomy_image_formatter', ), 'content_taxonomy_image_formatter_ORIGINAL_link' => array( 'arguments' => array('element' => NULL, 'link' => TRUE), 'function' => 'theme_content_taxonomy_image_formatter', ), ); if(function_exists('imagecache_presets')) { foreach (imagecache_presets() as $preset) { $theme['content_taxonomy_image_formatter_'. $preset['presetname']] = array( 'arguments' => array('element' => NULL, 'link' => FALSE), 'function' => 'theme_content_taxonomy_image_formatter', ); $theme['content_taxonomy_image_formatter_'. $preset['presetname'] .'_link'] = array( 'arguments' => array('element' => NULL, 'link' => TRUE), 'function' => 'theme_content_taxonomy_image_formatter', ); } } return $theme; } function theme_content_taxonomy_image_formatter($element, $link = FALSE) { if (!empty($element['#item']['value'])) { $term = taxonomy_image_get_object($element['#item']['value']); _content_taxonomy_localize_term($term); return l(taxonomy_image_display($term->tid, NULL, $element['#formatter'], array('wrapper' => FALSE)), 'taxonomy/term/' . $term->tid, array('html'=>TRUE)); } }