I'm making multistep modal form by following the example in ctools_ajax_sample.module.
I'm not seeing any Next/Cancel buttons added to my form, nor do I see the trail; None of the form components added in the ctools_wizard_wrapper() wrapper_callback are added to my form, despite the $form_info I'm passing to ctools_wizard_multistep_form() being (apparently) correct. Dumping $form immediately after calling ctools_wizard_multistep_form($form_info, $step, $form_state) in my code shows no buttons or ctools_trail, but it does in the example code.
Here's my definition of $form_info:
$form_info = array(
'id' => 'create_ticket',
'path' => "support/" . ($js ? 'ajax' : 'nojs') . "/modal/%step",
'show trail' => TRUE,
'show back' => TRUE,
'show cancel' => TRUE,
'show return' => FALSE,
'next callback' => 'create_ticket_next',
'finish callback' => 'create_ticket_finish',
'cancel callback' => 'create_ticket_cancel',
'order' => array(
'select_site' => t('Select a site'),
'ticket' => t('Create a ticket'),
),
'forms' => array (
'select_site' => array(
'form id' => 'select_site_form',
),
'ticket' => array(
'form id' => 'parature_ticket_form',
),
),
);
And here's where I call ctools_wizard_multistep_form, which doesn't include the multistep form buttons and trail (unlike in the example). Instead, the result is just the plain form as defined in the function that defines it.
$form = ctools_wizard_multistep_form($form_info, $step, $form_state);
$output = drupal_render($form);
I have confirmed that the wrapper_callback, ctools_wizard_wrapper (which is supposed to add these elements to the form), is being called. But nothing is added to the form.
Comments
Comment #1
nagiek commenteddoes it work when it's not in the modal?
Comment #2
Larksmann commentedNo - no trail or buttons show either way.
Comment #3
nagiek commentedPost your form - you may be overriding $form['buttons']
Comment #4
Larksmann commentedI don't think that's the issue. Even if I was, I'm certainly not overriding $form['ctools_trail']. Currently the first form is really simple:
Comment #5
merlinofchaos commentedIn Drupal 7 you must return $form. I bet that's your problem.
Comment #6
merlinofchaos commentedAnd by that I mean, the $form coming IN already has those elements. You are returning array() and ignoring what was sent to you. I'm 100% sure that is your problem.
Instead you should do
Comment #7
Larksmann commentedOf course! Thank you so much merlinofchaos - I can't believe how many hours I spent trying to track down the issue. I feel a little dumb now.