You are here

public function WebformSubmissionForm::previous in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/WebformSubmissionForm.php \Drupal\webform\WebformSubmissionForm::previous()

Webform submission handler for the 'previous' action.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

File

src/WebformSubmissionForm.php, line 1677

Class

WebformSubmissionForm
Provides a webform to collect and edit submissions.

Namespace

Drupal\webform

Code

public function previous(array &$form, FormStateInterface $form_state) {
  $pages = $this
    ->getPages($form, $form_state);

  // Get previous page.
  $current_page = $this
    ->getCurrentPage($form, $form_state);
  $previous_page = $this
    ->getPreviousPage($pages, $current_page);

  // Set previous page.
  $form_state
    ->set('current_page', $previous_page);

  // Submit previous page.
  $this
    ->wizardSubmit($form, $form_state);
}