function tablesort_cell

tablesort_cell($cell, $header, $ts, $i)

Formats a table cell.

Adds a class attribute to all cells in the currently active column.

Parameters

$cell: The cell to format.

$header: An array of column headers in the format described in theme_table().

$ts: The current table sort context as returned from tablesort_init().

$i: The index of the cell's table column.

Return value

A properly formatted cell, ready for _theme_table_cell().

File

includes/tablesort.inc, line 170
Functions to aid in the creation of sortable tables.

Code

function tablesort_cell($cell, $header, $ts, $i) {
  if (isset($header[$i]['data']) && $header[$i]['data'] == $ts['name'] && !empty($header[$i]['field'])) {
    if (is_array($cell)) {
      $cell['class'][] = 'active';
    }
    else {
      $cell = array('data' => $cell, 'class' => array('active'));
    }
  }
  return $cell;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!tablesort.inc/function/tablesort_cell/7.x