[development] Table hook idea

Gordon Heydon gordon at heydon.com.au
Thu Nov 8 01:10:54 UTC 2007


Hi,

Once drupal 6 is out I am going to be continuing my development of
merging theme(table) to the formapi. I have gotten the #pre_render into
the formapi so that we can generate the table from a drupal_render().

This means that the rendering of tables is moved into the form creation
which will simplify a lot of the admin pages in that they will not need
a theme() to create the page.

In e-Commerce I have a few use cases where I would like to be able to
alter the output of tables to include additional rows and columns, as
well as extending the information in cells.

One requested item is to be able to add shipping messages to
transactions. This is easy enough, but then getting this information out
is quite hard in that besides the invoice display, there is no where
without altering core ec code to add it. With this I can add an
additional row and display the message on the transaction search page.

Here is my proof of concept.
http://cvs.drupal.org/viewvc.py/drupal/contributions/sandbox/gordon/table_test/

It is written for Drupal 5, which is how I worked out that I needed the
#pre_render to be able to build a table.

Gordon.

Sean Robertson wrote:
> Got any examples of specific use cases?
> 
> 
> 
> Mike Cantelon wrote:
>> Is there any interest in adding hook support to table rows and cells to
>> allow on-the-fly modification of table data by modules? Something like
>> "table_alter($headers, $rows)" and/or "row_alter" and "cell_alter".
>> Seems to me this would be easy to do by adding support for an "id" key
>> for tables, rows, and/or cells so if the id is set the hook is invoked
>> in other modules.
>>
>> Cheers,
>> Mike
>>
> 


More information about the development mailing list