commit de1c1d5847d2ff2dc48649625220b28d871e2912 Author: Joel Pittet Date: Mon Dec 30 18:23:09 2013 -0800 remove and simplify tablesort_cell and rmeove the zebra for zoo todo diff --git a/core/includes/tablesort.inc b/core/includes/tablesort.inc index 1f6962b..3ad1dc1 100644 --- a/core/includes/tablesort.inc +++ b/core/includes/tablesort.inc @@ -65,35 +65,6 @@ function tablesort_header($cell, $header, $ts) { } /** - * Formats a table cell. - * - * Adds a class attribute to all cells in the currently active column. - * - * @param $cell - * The cell to format. - * @param $header - * An array of column headers in the format described in theme_table(). - * @param $ts - * The current table sort context as returned from tablesort_init(). - * @param $i - * The index of the cell's table column. - * - * @return - * A properly formatted cell, ready for _theme_table_cell(). - */ -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; -} - -/** * Composes a URL query parameter array for table sorting links. * * @return diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 5948e2d..ef1e781 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1682,10 +1682,6 @@ function template_preprocess_table(&$variables) { } if (!empty($variables['rows'])) { - - // Add odd/even class. - // @todo Replace this because zebras are for the zoo. - // @see http://drupal.org/node/1649780 $flip = array( 'even' => 'odd', 'odd' => 'even', @@ -1734,7 +1730,9 @@ function template_preprocess_table(&$variables) { } // Add active class if needed for sortable tables. - $cell = tablesort_cell($cell, $variables['header'], $ts, $i); + if (isset($variables['header'][$i]['data']) && $variables['header'][$i]['data'] == $ts['name'] && !empty($variables['header'][$i]['field'])) { + $cell['attributes']['class'][] = 'active'; + } // Move cell properties that are not data, attributes or header // property into attributes.