summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2006-08-03 20:37:52 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2006-08-03 20:37:52 +0000
commit3ffb612aeae073ba00c34181f8255e2702306d0a (patch)
tree8d531b7abdaaa784c12c2e3197e082e83b44d8dd
parent8c1560c75694a701a5fce69d0b5b2c19dd218678 (diff)
downloadbrdo-3ffb612aeae073ba00c34181f8255e2702306d0a.tar.gz
brdo-3ffb612aeae073ba00c34181f8255e2702306d0a.tar.bz2
#76741: Allow <th> tags for theme_table cells
-rw-r--r--includes/theme.inc16
1 files changed, 8 insertions, 8 deletions
diff --git a/includes/theme.inc b/includes/theme.inc
index 3201ffbd7..1e576f358 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -663,6 +663,7 @@ function theme_submenu($links) {
*
* Each cell can be either a string or an associative array with the following keys:
* - "data": The string to display in the table cell.
+ * - "header": Indicates this cell is a header.
* - Any HTML attributes, such as "colspan", to apply to the table cell.
*
* Here's an example for $rows:
@@ -699,7 +700,7 @@ function theme_table($header, $rows, $attributes = array(), $caption = NULL) {
$output .= ' <thead><tr>';
foreach ($header as $cell) {
$cell = tablesort_header($cell, $header, $ts);
- $output .= _theme_table_cell($cell, 1);
+ $output .= _theme_table_cell($cell, TRUE);
}
$output .= " </tr></thead>\n";
}
@@ -739,7 +740,7 @@ function theme_table($header, $rows, $attributes = array(), $caption = NULL) {
$i = 0;
foreach ($cells as $cell) {
$cell = tablesort_cell($cell, $header, $ts, $i++);
- $output .= _theme_table_cell($cell, 0);
+ $output .= _theme_table_cell($cell);
}
$output .= " </tr>\n";
}
@@ -1001,16 +1002,15 @@ function theme_progress_bar($percent, $message) {
* @} End of "defgroup themeable".
*/
-function _theme_table_cell($cell, $header = 0) {
+function _theme_table_cell($cell, $header = FALSE) {
$attributes = '';
if (is_array($cell)) {
$data = $cell['data'];
- foreach ($cell as $key => $value) {
- if ($key != 'data') {
- $attributes .= " $key=\"$value\"";
- }
- }
+ $header |= isset($cell['header']);
+ unset($cell['data']);
+ unset($cell['header']);
+ $attributes = drupal_attributes($cell);
}
else {
$data = $cell;