diff --git a/includes/theme.inc b/includes/theme.inc index af3259e679..9fc7d0c558 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -2074,6 +2074,8 @@ function theme_table(array $variables) { ); } + // Assigning back the $rows variable into $variables as we won't modify it + // anymore. $variables['rows'] = $rows; // Format the table header. @@ -2096,8 +2098,8 @@ function theme_table(array $variables) { $sections = array(); - if (!empty($variables['rows'])) { - $sections['tbody'] = $variables['rows']; + if (!empty($rows)) { + $sections['tbody'] = $rows; } if (!empty($variables['footer'])) { @@ -2110,11 +2112,11 @@ function theme_table(array $variables) { $output .= "<" . $tag . ">\n"; $flip = array('even' => 'odd', 'odd' => 'even'); $class = 'even'; + $no_striping = $tag === 'tfoot'; foreach ($content as $number => $row) { $cells = $row; $attributes = array(); - $no_striping = $tag === 'tfoot'; // Check if we're dealing with a simple or complex row. if (isset($row['data'])) { @@ -2128,7 +2130,6 @@ function theme_table(array $variables) { unset($attributes['no_striping']); } - // Build row. if (!empty($cells)) { // Add odd/even class. if (!$no_striping) { @@ -2136,6 +2137,7 @@ function theme_table(array $variables) { $attributes['class'][] = $class; } + // Build row. $output .= ' '; $i = 0; foreach ($cells as $cell) {