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

4.7.x
Dries Buytaert 2005-09-15 20:58:17 +00:00
parent da74bce9bc
commit 5971f1e645
1 changed files with 5 additions and 5 deletions

View File

@ -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) {
// 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) {
} }
} }
$output .= "</table>\n"; $output .= "</tbody></table>\n";
return $output; return $output;
} }