function tabledrag_example_theme in Examples for Developers 7
Implements hook_theme().
We need run our forms through custom theme functions in order to build the table structure which is required by tabledrag.js. Before we can use our custom theme functions, we need to implement hook_theme in order to register them with Drupal.
We are defining our theme hooks with the same name as the form generation function so that Drupal automatically calls our theming function when the form is displayed.
Related topics
File
- tabledrag_example/
tabledrag_example.module, line 68 - An example of how to build a sortable form using tabledrag.
Code
function tabledrag_example_theme() {
return array(
// Theme function for the 'simple' example.
'tabledrag_example_simple_form' => array(
'render element' => 'form',
'file' => 'tabledrag_example_simple_form.inc',
),
// Theme function for the 'parent/child' example.
'tabledrag_example_parent_form' => array(
'render element' => 'form',
'file' => 'tabledrag_example_parent_form.inc',
),
);
}