You are here

function taxonomy_image_handler_arg_taximg in Taxonomy Image 5

1 string reference to 'taxonomy_image_handler_arg_taximg'
taxonomy_image_views_arguments in ./taxonomy_image.module

File

./taxonomy_image.module, line 685
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_arg_taximg($op, &$query, $argtype, $arg = '') {
  switch ($op) {
    case 'summary':
      $query
        ->ensure_table('term_data');
      $query
        ->add_field('name', 'term_data');
      $query
        ->add_field('weight', 'term_data');
      $query
        ->add_field('tid', 'term_data');
      $fieldinfo['field'] = "term_data.name";
      return $fieldinfo;
    case 'sort':
      $query
        ->add_orderby('term_data', 'weight', $argtype);
      $query
        ->add_orderby('term_data', 'name', $argtype);
      break;
    case 'filter':
      $query
        ->ensure_table('term_data');
      $query
        ->add_where('term_data.tid = %d', $arg);
      $query
        ->set_distinct();
      break;
    case 'link':
      $tid = intval($query->tid);
      if ($tid) {
        $img = taxonomy_image_display($tid, NULL, NULL, array(
          'wrapper' => FALSE,
        ));
      }
      else {
        $img = t('Uncategorized');
      }
      return l($img, "{$arg}/" . $tid, array(), NULL, NULL, FALSE, TRUE);
    case 'title':
      $result = db_query("SELECT name FROM {term_data} WHERE tid = %d", $query);
      $term = db_fetch_object($result);
      return $term->name ? check_plain($term->name) : t('Uncategorized');
  }
}