You are here

function ctools_wizard_submit in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 includes/wizard.inc \ctools_wizard_submit()

On a submit, go to the next form.

1 string reference to 'ctools_wizard_submit'
ctools_wizard_wrapper in includes/wizard.inc
Provide a wrapper around another form for adding multi-step information.

File

includes/wizard.inc, line 367
CTools' multi-step form wizard tool.

Code

function ctools_wizard_submit(&$form, &$form_state) {
  if (isset($form_state['clicked_button']['#wizard type'])) {
    $type = $form_state['clicked_button']['#wizard type'];

    // if AJAX enabled, we proceed slightly differently here.
    if (!empty($form_state['ajax'])) {
      if ($type == 'next') {
        $form_state['ajax next'] = $form_state['clicked_button']['#next'];
      }
    }
    else {
      if ($type == 'cancel' && isset($form_state['form_info']['cancel path'])) {
        $form_state['redirect'] = $form_state['form_info']['cancel path'];
      }
      else {
        if ($type == 'next') {
          $form_state['redirect'] = ctools_wizard_get_path($form_state['form_info'], $form_state['clicked_button']['#next']);
        }
        else {
          if (isset($form_state['form_info']['return path'])) {
            $form_state['redirect'] = $form_state['form_info']['return path'];
          }
          else {
            if ($type == 'finish' && isset($form_state['form_info']['cancel path'])) {
              $form_state['redirect'] = $form_state['form_info']['cancel path'];
            }
          }
        }
      }
    }
  }
}