Skip to content

Instantly share code, notes, and snippets.

@steveoliver
Created November 14, 2013 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steveoliver/7469874 to your computer and use it in GitHub Desktop.
Save steveoliver/7469874 to your computer and use it in GitHub Desktop.
Next buttons first
diff --git a/includes/wizard.inc b/includes/wizard.inc
index 6f5d794..a3227b5 100644
--- a/includes/wizard.inc
+++ b/includes/wizard.inc
@@ -291,13 +291,25 @@ function ctools_wizard_wrapper($form, &$form_state) {
$button_attributes = array('class' => array('ctools-use-ajax'));
}
+ // If there is a next form, place the next button.
+ if (isset($form_state['next']) || !empty($form_info['free trail'])) {
+ $form['buttons']['next'] = array(
+ '#type' => 'submit',
+ '#value' => $form_info['next text'],
+ '#next' => !empty($form_info['free trail']) ? $form_state['step'] : $form_state['next'],
+ '#wizard type' => 'next',
+ '#weight' => -2000,
+ '#attributes' => $button_attributes,
+ );
+ }
+
if (!empty($form_info['show back']) && isset($form_state['previous'])) {
$form['buttons']['previous'] = array(
'#type' => 'submit',
'#value' => $form_info['back text'],
'#next' => $form_state['previous'],
'#wizard type' => 'next',
- '#weight' => -2000,
+ '#weight' => -1000,
'#limit_validation_errors' => array(),
// hardcode the submit so that it doesn't try to save data.
'#submit' => array('ctools_wizard_submit'),
@@ -309,18 +321,6 @@ function ctools_wizard_wrapper($form, &$form_state) {
}
}
- // If there is a next form, place the next button.
- if (isset($form_state['next']) || !empty($form_info['free trail'])) {
- $form['buttons']['next'] = array(
- '#type' => 'submit',
- '#value' => $form_info['next text'],
- '#next' => !empty($form_info['free trail']) ? $form_state['step'] : $form_state['next'],
- '#wizard type' => 'next',
- '#weight' => -1000,
- '#attributes' => $button_attributes,
- );
- }
-
// There are two ways the return button can appear. If this is not the
// end of the form list (i.e, there is a next) then it's "update and return"
// to be clear. If this is the end of the path and there is no next, we
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment