You are here

function taxonomy_image_views_handler_link in Taxonomy Image 5

Handler for Taxonomy Image views field as link.

File

./taxonomy_image.module, line 670
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_views_handler_link($fieldinfo, $fielddata, $value, $data) {
  if (empty($fielddata['options'])) {
    $img = taxonomy_image_display($value, $data->name, NULL, array(
      'wrapper' => FALSE,
    ));
    $img = l($img, drupal_get_path_alias(taxonomy_term_path(taxonomy_get_term($value))), array(), NULL, NULL, FALSE, TRUE);
    return $img;
  }
  else {
    $profile = imagecache_preset($fielddata['options']);
    $profile_name = $profile['presetname'];
    $img = taxonomy_image_display($value, $data->name, $profile_name, array(
      'wrapper' => FALSE,
    ));
    $img = l($img, drupal_get_path_alias(taxonomy_term_path(taxonomy_get_term($value))), array(), NULL, NULL, FALSE, TRUE);
    return $img;
  }
}