You are here

function ctools_wizard_get_path in Chaos Tool Suite (ctools) 7

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

Create a path from the form info and a given step.

4 calls to ctools_wizard_get_path()
ctools_stylizer_edit_style_next in includes/stylizer.inc
Callback generated when the 'next' button is clicked.
ctools_wizard_submit in includes/wizard.inc
On a submit, go to the next form.
ctools_wizard_wrapper in includes/wizard.inc
Provide a wrapper around another form for adding multi-step information.
page_manager_page_add_subtask_next in page_manager/plugins/tasks/page.admin.inc
Callback generated when the 'next' button is clicked.

File

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

Code

function ctools_wizard_get_path($form_info, $step) {
  if (is_array($form_info['path'])) {
    foreach ($form_info['path'] as $id => $part) {
      $form_info['path'][$id] = str_replace('%step', $step, $form_info['path'][$id]);
    }
    $path = $form_info['path'];
  }
  else {
    $path = array(
      str_replace('%step', $step, $form_info['path']),
    );
  }

  // If destination is set, carry it over so it'll take effect when
  // saving. The submit handler will unset destination to avoid drupal_goto
  // redirecting us.
  if (!empty($_GET['destination'])) {

    // Ensure that options is an array.
    if (!isset($path[1]) || !is_array($path[1])) {
      $path[1] = array();
    }

    // Add the destination parameter, if not set already.
    $path[1] += drupal_get_destination();
  }
  return $path;
}