Community Documentation

Translate Field Label for Views Tables

Last updated June 5, 2008. Created by Shai on June 5, 2008.
Log in to edit this page.

This snippet is so that Views tables will be able to create translatable labels.

Make a custom module for your with the following function:

<?php
function otnet_views_pre_view(&$view, &$items) {
if (
$view->page_type == 'table') {
  
$table_header = $view->table_header;
   foreach (
$table_header as $curr => $val) {
     if (
$val['data']) {
      
$val['data'] = t($val['data']);
     }
    
$view->table_header[$curr] = $val
?>

About this page

Drupal version
Drupal 5.x

Reference

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.