tablesort_cell

5 tablesort.inc tablesort_cell($cell, $header, $ts, $i)
6 tablesort.inc tablesort_cell($cell, $header, $ts, $i)
7 tablesort.inc tablesort_cell($cell, $header, $ts, $i)
8 tablesort.inc tablesort_cell($cell, $header, $ts, $i)

Format 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().

1 call to tablesort_cell()

File

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

Code

function tablesort_cell($cell, $header, $ts, $i) {
  if (isset($header[$i]) && $header[$i]['data'] == $ts['name'] && $header[$i]['field']) {
    if (is_array($cell)) {
      if (isset($cell['class'])) {
        $cell['class'] .= ' active';
      }
      else {
        $cell['class'] = 'active';
      }
    }
    else {
      $cell = array(
        'data' => $cell,
        'class' => 'active',
      );
    }
  }
  return $cell;
}
Login or register to post comments