Перевод терминов таксономии во views drupal 7

Дата публикации: 10 03 2015 Автор: PazitiFF
/*
 * Implementation hook_views_api()
 */
function helper_views_api() {
  return array(
    'api' => 3,
  );
}
 
/*
 * Implementation of hook_views_pre_render(&$view)
 */
function helper_views_pre_render(&$view) {
  global $language;
 
  foreach($view->result as $delta => $term ){
    if(isset($term->tid)) {
 
      i18n_string_translate_langcode( $language->language );
      $localized_term = i18n_taxonomy_localize_terms( taxonomy_term_load( $term->tid ));
      $term->tid = $localized_term->tid;
      $term->taxonomy_term_data_name = $localized_term->name;
    }
  }
}

Add new comment

Plain text

  • No HTML tags allowed.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <apache>, <bash>, <css>, <drupal6>, <html5>, <javascript>, <mysql>, <php>.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.