Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The theme named form_panel_table
provides a table-based output. The theme named form_panel_div
wraps each row in a <div>
tag with a specific class, and each element in its own <div>
.
You can choose which theme to use by assigning it to the #theme attribute of the form element enclosing those you wish to theme. For instance:
$form = array('#theme' => 'form_panel_table');
$form['foo'] = ...first form element goes here...
$form['bar'] = ...second form element goes here...
If you are adding a table or <div>
set to an existing form, it can help to put this into a sub-array:
$form['my-table'] = array('#theme' => 'form_panel_table');
$form['my-table']['foo'] = ...first form element goes here...
$form['my-table']['bar'] = ...second form element goes here...
Comments
Where does the code go?
Sorry, but I think I'm missing something basic.
Where do you add/edit this code?
Did you find an answer
Hi.
A non drupal ninja would love to use this but cant work it out... :-(
Is there a screencast or A to Z tutorial out there?
Thx