[development] form elements will be easy to put into a table

Barry Jaspan barry at jaspan.org
Fri Apr 27 13:25:39 UTC 2007

> I have done some work on this and added it to my sandbox. So please
> give me some feedback.

I think this resolves an annoyance I've had with theme('table') for a
while: the theme function cannot assume the table is in "normal form"
(every element uses a 'data' attribute).  If I want to theme the first
column of the first row differently, I'd like to write something like:

function mytheme_table($hdrs, $rows) {
  $rows[0][0]['class'] .= ' first';
  return theme_table($hdrs, $rows);

but I can't because $rows[0][0] might just be a string to display, so
I have to normalize it first.  (It also might span more than one
row/column but that is a separate issue.)

With your approach I can assume that $rows[0][0] is an array and can
safely write:

  $rows[0][0]['#attributes']['class'] .= ' first';

Right?  If so, then +1 from me.



More information about the development mailing list