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

Gordon Heydon gordon at heydon.com.au
Fri Apr 27 07:16:47 UTC 2007


Hi,

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

It is an include and a test module which give you a couple of tables 
with good data and bad data (ie missing cells/incomplete rows)

This will actually work Drupal 5. I am just playing with it to make sure 
that I can cover everything.

see 
http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/gordon/table_test/ 
for my code.

ATM it requires a full form to function so it will not render with just 
a drupal_render()

What needs to be done.

- Zebra pattern for rows.
- Add row grouping so you can have tables with many columns display over 
several rows.
- Get the pager working with it.
- Get colspans and rowspans working.
- Add something like a #process_render function that will be called at 
the beginning of drupal_render() to do all the preprocessing so that all 
the columns line up etc.
- create a patch to commit to Drupal 6.

The advantages that this has over the current theme('table') is that the 
re is much more flexibility in creating tables, such as multi row 
headings, altering the contents of cells and adding additional 
columns/rows without changing the base module.

For me this is going to allow me in E-Commerce have the modules alter 
the transaction search output so we can add additional columns, add data 
to existing columns, add additional rows. and output more relevant 
information.

Let me know what you think.
Gordon.

Gordon Heydon wrote:
> Hi,
> 
> I am actually part way through doing this, I have a table, row, and cell 
> which can be implemented.
> 
> I will make sure it is going to commit it to my sandbox.
> 
> Gordon.
> 
> Karoly Negyesi wrote:
>> If someone implements the following.
>>
>> Change theme('table') so that it uses a fapi style array and render it 
>> with drupal_render.
>>
>> To upgrade existing tables, for a cell,
>>
>> a) if the content was just 'foo' , make that array('#value' => 'foo')
>> b) if there was a 'data' key use #value instead . All other keys go 
>> under #attributes
>>
>> For a row, if there was no data key, nothing to do. If there was, move 
>> everything else to #attributes and make the 'data' the content of row.
>>
>> Thoughts and volunteers are welcome.
>>
>> Regards,
>>
>> NK
>>
>> Ps. Rationale, we require non-Drupaler coders to learn several 
>> structured complex arrays. This decreases the number. And eventually 
>> we will want drupal_render to pwn the page so this is a step...
>>
>>
>>
> 
> !DSPAM:1000,46316b03192512601091748!
> 


More information about the development mailing list