Created
November 14, 2013 16:33
-
-
Save steveoliver/7469874 to your computer and use it in GitHub Desktop.
Next buttons first
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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