drupal форма переопределяет функцию темы

Я создал модуль, который генерирует небольшую форму. Я также сделал функцию, которая должна оформлять форму, переопределяя стандартную тему. Но по какой-то причине он не вызывает функцию theme_. Я что-то забыл?

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;
}

person dazz    schedule 19.02.2010    source источник


Ответы (1)


Я думаю, вы забыли реализовать hook_theme. Попробуйте добавить это:

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

Не забудьте обновить реестр вашей темы после добавления этого кода.

person marcvangend    schedule 19.02.2010