tags:

views:

483

answers:

1

I have the following in my template.php file:

function theme098_theme() {
  return array(
    'email_node_form' => array(
      'arguments' => array('form' => NULL),
    )
  );
}

and...

function theme098_email_node_form($form) {
    return drupal_render($form);
}

I've excluded the code where i actually modify the form and cut it down so that no modifications happen. Two problems occur:

  1. The order of items (i.e. their weights) is messed up. The save button is at the top etc. Even if I try to edit the form by setting the weight, the save button STILL appears at the top.
  2. The real problem: Conditional fields doesn't work. For some reason, I think this overwrites what other modules are supposed to do? I'm not sure

Can anyone shed some light?

+2  A: 

3 things.

  1. In this case you should probably use hook_form_alter(), if you want to change the order or change the form, instead of using a theme function to alter it. Keep presentation and logic separated.
  2. When you define theme functions with hook theme, you should call them theme_xxx instead of themename_/ modulename_.
  3. Modules (and possible themes) have a weight weight that determines the order they are run with functions like hook_*_alter. Look at the install file for the devel module to see how this is done.

One or more of these things should help you out.

googletorp
Did help alot. Thanks.
RD

related questions