diff --git a/includes/theme.inc b/includes/theme.inc index dabf1dfd22..fb576b07db 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -2074,6 +2074,8 @@ function theme_table(array $variables) { ); } + $variables['rows'] = $rows; + // Format the table header. if (!empty($header)) { $ts = tablesort_init($header); @@ -2092,54 +2094,57 @@ function theme_table(array $variables) { $ts = array(); } - // Rows and footer have the same structure. $sections = array( - 'rows' => 'tbody', - 'footer' => 'tfoot', + 'tbody' => $rows, ); - $variables['rows'] = $rows; - foreach ($sections as $section => $tag) { - if (!empty($variables[$section])) { - $output .= "<" . $tag . ">\n"; - $flip = array('even' => 'odd', 'odd' => 'even'); - $class = 'even'; - foreach ($variables[$section] as $number => $row) { - $cells = $row; - $attributes = array(); - $no_striping = $section === 'footer'; - - // Check if we're dealing with a simple or complex row. - if (isset($row['data'])) { - $cells = $row['data']; - $no_striping = isset($row['no_striping']) ? - $row['no_striping'] : $no_striping; - - // Set the attributes array and exclude 'data' and 'no_striping'. - $attributes = $row; - unset($attributes['data']); - unset($attributes['no_striping']); - } - // Add odd/even class. - if (!$no_striping) { - $class = $flip[$class]; - $attributes['class'][] = $class; - } + if (!empty($variables['footer'])) { + $sections['tfoot'] = $variables['footer']; + } - // Build row. - if (!empty($cells)) { - $output .= '