1. The Two Themes

Last updated on
30 April 2025

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...

Help improve this page

Page status: Not set

You can: