You are here

public function Wizard::prevSubmit in Examples for Developers 8

Same name and namespace in other branches
  1. 3.x modules/ajax_example/src/Form/Wizard.php \Drupal\ajax_example\Form\Wizard::prevSubmit()

Ajax callback that moves the form to the previous step.

Parameters

array $form: The Form API form.

\Drupal\Core\Form\FormStateInterface $form_state: The FormState object.

Return value

array The Form API form.

File

ajax_example/src/Form/Wizard.php, line 213

Class

Wizard
AJAX example wizard.

Namespace

Drupal\ajax_example\Form

Code

public function prevSubmit(array $form, FormStateInterface $form_state) {
  $form_state
    ->setValue('step', $form_state
    ->getValue('step') - 1);
  $form_state
    ->setRebuild();
  return $form;
}