[development] theme('table')

Gordon Heydon gordon at heydon.com.au
Mon Apr 23 01:21:12 UTC 2007


Moshe Weitzman wrote:
> Gordon Heydon wrote:
>> Hi,
>> adrian rossouw wrote:
>>> On 21 Apr 2007, at 8:41 PM, Moshe Weitzman wrote:
>>>> this sounds nice and consistent to me ... or we expand drupal_render 
>>>> usage and expect folks to override #theme if they want to take over 
>>>> themeing for a certain table. that seems like a more long term 
>>>> project, with more a bit more uncertainty.
>>> doesn't that work today though ?
>>> just needing a documentation change.
> i think it does. so whats needed is some general agreement that we 
> should output tables not directly through theme('table') but rather with 
> a construct like:
> $page['forum_overview'] = array(
>   '#type' => 'table',
>   '#header' => $header,
>   '#rows' => $rows
> )
> $output = drupal_render($page);
> the big advantage is that modules can alter a table as suggested by 
> Gordon and that themers can override a single table with #theme. the 
> disadvantage is a small performance dip. we'll do some benchmarking to 
> understand the amount.
> note that i'm only talking about output of tables through 
> drupal_render(), not whole page.

Yes I have actually started on this. Also I have done it so that it 
allows the naming of columns, so that hook_form_alter() can alter the 
contents of cells, and also so that you don't have to have all columns 
on all rows.

Other advantages is that you can weight columns to put them where ever 
you want.

This is something that I really need in E-Commerce for the transaction 
search table.


> !DSPAM:1000,462b593f101281670870668!

More information about the development mailing list