Drupal doesn't call my theme function for my form in my module.
I added the hook_theme in the .module file as this :
function agil_theme() {
return array(
'agil_list_form' => array(
'render element' => 'form',
),
);
}
where :
- agil is the name of my module (not my theme)
- agil_list_form is the name of my form declaration (chich render with default theme)
I want to call a function to create my own markup, as this one :
function theme_agil_list_form($form) {
$output = "<table><th><td></td><td>".t('Title')."</td><td>".t('Link')."</td></th>";
$output .= "<tr><td>";
$output .= drupal_render($form['name']);
...
But Drupal is never calling this function… I cleared the cache but nothing..
Where do I miss something ?
I read also this about new theme declaration in Drupal 7 :
http://drupal.org/update/modules/6/7#hook_theme_render_changes
Best Answer
All theme functions in Drupal 7 take a single array argument (usually named as
$vars
or$variables
by convention), and that array contains the variables/render elements you've declared. The theme function itself would look like this:Also you need to tell Drupal that your form will be using this theme, by doing this in your form function: