Calling Theme () custom function for a form in Drupal 7

Drupal does not call my theme function for my form in my module.

I added hook_theme to the .module file like 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 the declaration of my form (chich render with the default theme)

I want to call a function to create my own markup, like this:

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 never calls this function ... I cleared the cache, but nothing ..

Where can I skip something?

I also read this about the new topic declaration in Drupal 7: http://drupal.org/update/modules/6/7#hook_theme_render_changes

+3
source share
1 answer

Drupal 7 ( $vars $variables ), / . :

function theme_agil_list_form($vars) {
  $form = $vars['form'];
  // Now manipulate $form
}

Drupal, , :

$form['#theme'] = 'agil_list_form';
+5

All Articles