function FormWizardBase::previous
Same name and namespace in other branches
- 4.0.x src/Wizard/FormWizardBase.php \Drupal\ctools\Wizard\FormWizardBase::previous()
Form submit handler to step backwards in the wizard.
"Next" steps are handled by \Drupal\Core\Form\FormInterface::submitForm().
Parameters
array $form: Drupal form array.
\Drupal\Core\Form\FormStateInterface $form_state: The current form state of the wizard. This will not contain values from the current step since the previous button does not actually submit those values.
Overrides FormWizardInterface::previous
File
-
src/
Wizard/ FormWizardBase.php, line 329
Class
- FormWizardBase
- The base class for all form wizard.
Namespace
Drupal\ctools\WizardCode
public function previous(array &$form, FormStateInterface $form_state) {
$cached_values = $form_state->getTemporaryValue('wizard');
$prev_parameters = $this->getPreviousParameters($cached_values);
// Redirect for non ajax forms.
if (!$form_state->get('ajax')) {
$form_state->setRedirect($this->getRouteName(), $prev_parameters);
}
else {
// Switch step for ajax forms.
if (!empty($prev_parameters['step'])) {
$this->step = $prev_parameters['step'];
}
}
}