2010-02-19 10 views
0

J'ai créé un module qui génère une petite forme. J'ai également fait une fonction qui devrait thématiser le formulaire, en remplaçant le thème standard. Mais pour une raison quelconque, il n'appelle pas la fonction theme_. Est-ce que j'oublie quelque chose?drupal formulaire override thème fonction

function mailinglist_menu() { 

    $items['mailinglist'] = array(
    'title' => t('Beheer mailinglist'), 
    'page callback' => 'mailinglist_overzicht', 
    'access arguments' => array('access content'), 
    'type' => MENU_CALLBACK, 
); 

    return $items; 
} 

function mailinglist_overzicht() { 

    return drupal_get_form('mailinglist_form'); 

} 

function mailinglist_form($form_state) { 

    $form['to'] = array(
    '#type' => 'fieldset', 
    '#title' => t('Aan'), 
    '#tree' => TRUE, 
); 
    $form['to']['functies'] = array(
    '#type' => 'checkboxes', 
    '#title' => t('Functies'), 
    '#options' => mailinglist_getFuncties(), 
    '#description' => t('Selecteer de functies die je wilt mailen.'), 
); 

    return $form; 
} 

function theme_mailinglist_form($form) { 
    $output .= '<div class="foo" style="background-color: #000;">sdfsdfsdfdfs'; 
    $output = drupal_render($form['to']['functies']); 
    $output .= '<div class="bar">'; 
    $output .= '</div></div>'; 
    $output .= drupal_render($form); 

    return $output; 
} 

Répondre

1

Je pense que vous avez oublié d'implémenter hook_theme. Essayez d'ajouter ceci:

function mailinglist_theme() { 
    return array(
    'mailinglist_form' => array(
     'arguments' => array('form' => NULL), 
    ), 
); 
} 

N'oubliez pas d'actualiser votre registre de thème après avoir ajouté ce code.

+0

cela fonctionne, tnx. – dazz

+0

graag gedaan :-) – marcvangend

Questions connexes