Posted by susie_agerholm on February 3, 2013 at 11:46am
Hi,
I'm trying to theme a multistep form. I have created a theming function for each step, but I'm having a lot of trouble getting the steps to pick up the appropriate theming function.
So far:
I have assigned each form step a theming function reference like so:
function first_step_of_multistep_form() {
$form = array();
(...)
$form['#theme'] = 'theme_energy_leadgen_form';
return $form;
} When I krumo out contents of form, the theming reference shows up in array
I have registered my theming functions with hook_theme:
function energy_leadgen_theme() {
return array(
//Declaring theming function for all three steps in form
'energy_leadgen_form' => array(
'render element' => 'form',
),
'energy_leadgen_form_contact' => array(
'render element' => 'form',
),
'energy_leadgen_form_payoff' => array(
'render element' => 'form',
),
(...)I have created the different theming functions:
example - first theming function:
function theme_energy_leadgen_form($variables) {
$form = $variables['form'];
$output .= '<div class="intro_class">' . drupal_render($form['sprmaal']['intro'] . '</div>');
$output .= drupal_render($form['sprmaal']['employees']);
$output .= drupal_render($form['sprmaal']['buildings']);
$output .= drupal_render($form['sprmaal']['energy']);
$output .= drupal_render($form['sprmaal']['measuring']);
$output .= drupal_render($form['sprmaal']['effort']);
$output .= drupal_render($form['calculate']);
$output .= drupal_render_children($form);
return $output;
}But none of the HTML added within theming function seems to appear in rendered form. What am I doing wrong??? I have themed diff. elements within the form using this m.o. and this worked fine...