Commit 5971f1e6 authored by Dries's avatar Dries
Browse files

- Patch #28777 by Neil: use <thead> and <tbody> in theme_table().

parent da74bce9
...@@ -697,8 +697,7 @@ function theme_submenu($links) { ...@@ -697,8 +697,7 @@ function theme_submenu($links) {
* @return * @return
* An HTML string representing the table. * An HTML string representing the table.
*/ */
function theme_table($header, $rows, $attributes = NULL, $caption = NULL) { function theme_table($header, $rows, $attributes = array(), $caption = NULL) {
$output = '<table'. drupal_attributes($attributes) .">\n"; $output = '<table'. drupal_attributes($attributes) .">\n";
if (isset($caption)) { if (isset($caption)) {
...@@ -708,15 +707,16 @@ function theme_table($header, $rows, $attributes = NULL, $caption = NULL) { ...@@ -708,15 +707,16 @@ function theme_table($header, $rows, $attributes = NULL, $caption = NULL) {
// Format the table header: // Format the table header:
if (count($header)) { if (count($header)) {
$ts = tablesort_init($header); $ts = tablesort_init($header);
$output .= ' <tr>'; $output .= ' <thead><tr>';
foreach ($header as $cell) { foreach ($header as $cell) {
$cell = tablesort_header($cell, $header, $ts); $cell = tablesort_header($cell, $header, $ts);
$output .= _theme_table_cell($cell, 1); $output .= _theme_table_cell($cell, 1);
} }
$output .= " </tr>\n"; $output .= " </tr></thead>\n";
} }
// Format the table rows: // Format the table rows:
$output .= "<tbody>\n";
if (count($rows)) { if (count($rows)) {
foreach ($rows as $number => $row) { foreach ($rows as $number => $row) {
$attributes = array(); $attributes = array();
...@@ -756,7 +756,7 @@ function theme_table($header, $rows, $attributes = NULL, $caption = NULL) { ...@@ -756,7 +756,7 @@ function theme_table($header, $rows, $attributes = NULL, $caption = NULL) {
} }
} }
$output .= "</table>\n"; $output .= "</tbody></table>\n";
return $output; return $output;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment