You are here

function views_handler_field_allterms in Views (for Drupal 7) 5

Display all the terms for a given vocabulary

1 string reference to 'views_handler_field_allterms'
taxonomy_views_tables in modules/views_taxonomy.inc
This include file implements views functionality on behalf of taxonomy.module

File

modules/views_taxonomy.inc, line 269

Code

function views_handler_field_allterms($fieldinfo, $fielddata, $value, $data) {
  if ($fieldinfo['vocabulary']) {
    $terms = taxonomy_node_get_terms_by_vocabulary($data->nid, $fieldinfo['vocabulary']);
  }
  else {
    $terms = taxonomy_node_get_terms($data->nid);
  }
  if ($fielddata['options'] == 'nolink') {
    foreach ($terms as $term) {
      $links[] = check_plain($term->name);
    }
    $links = !empty($links) ? implode(' | ', $links) : '';
  }
  else {
    $node = new stdClass();
    $node->taxonomy = $terms;
    $links = theme('links', taxonomy_link('taxonomy terms', $node));
  }
  return $links;
}