You are here

function i18nviews_views_handler_field_allterms in Internationalization Views 7.3

Same name and namespace in other branches
  1. 6.3 i18nviews.module \i18nviews_views_handler_field_allterms()
  2. 6.2 i18nviews.module \i18nviews_views_handler_field_allterms()

Field handler for taxonomy term fields.

Remake of views_handler_field_allterms with term name translation.

TODO CHECK

File

./i18nviews.module, line 40
Views support for Internationalization (i18n) package

Code

function i18nviews_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);
  }

  // Translate all these terms.
  _i18ntaxonomy_translate_terms($terms);
  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;
}