Dear Forum,

I'd like to use 'colspan' in a table header. The documentation of theme_table[1] tells me the following:

$header An array containing the table headers. Each element of the array can be either a localized string or an associative array with the following keys:

* "data": The localized title of the table column.
* "field": The database field represented in the table column (required if user is to be able to sort on this column).
* "sort": A default sort order for this column ("asc" or "desc").
* Any HTML attributes, such as "colspan", to apply to the column header cell.

But looking at the code on that same page tells me 'drupal_attributes()' isn't used on the table header row.

'By design' or 'Report bug on theme_table()' or 'Report bug on documentation'?

Cheers!

Harold.

[1] http://api.drupal.org/api/function/theme_table/6

Comments

agentrickard’s picture

aaronchristian’s picture

This is for D7, but heres an example of how to accomplish this;

$monthly_table = array(
  'header' => array(
    'heading' => array(
      'data'  => t('Device price - Due monthly'),
      'colspan' => 2,
     ),
   ),
   'rows' => array(
   ),
   'attributes' => array(),
   'caption' => '',
   'colgroups' => array(),
   'sticky' => FALSE,
   'empty' => '',
);

return theme_table($monthly_table);
tsmulugeta’s picture

If I have a field within a form whose Help Text I want to change, how would I utilize your code to make the change given that the colspan for the help text is incorrect.