API page: http://api.drupal.org/api/drupal/includes--theme.inc/function/theme_table/7

Describe the problem you have found:

The examples for $rows[] and cells state that you can add any html attributes - and especially class attributes.

  • Any HTML attributes, such as "class", to apply to the table row.

It should be noted that you should use an array for html "class" attributes, because if you don't you will break the default tablesorters.

The docs should read something like:

  • Any HTML attributes, such as "id", to apply to the table row. To add a "class" attribute you should add an array as follows: 'class' => array('extraclassname').

(the attached file has a non working and a working scenario)

CommentFileSizeAuthor
tablesorter-issue-example.txt1.71 KBjadwigo
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon’s picture

Title: Documentation problem with theme_table » theme_table() [and other HTML element theme functions?] should document class attributes being an array
Version: 7.x-dev » 8.x-dev
Issue tags: +Needs backport to D7

Good idea... This is a common attribute to add... We should probably create and then point to some standard documentation on how to add attributes to various HTML things.

jhodgdon’s picture

Status: Active » Closed (duplicate)

This is actually the same issue as #1135020: Need standard way to document the format of attributes in theme functions, so I am marking this as a duplicate.