You are here

public function WebformSubmissionForm::next in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/WebformSubmissionForm.php \Drupal\webform\WebformSubmissionForm::next()

Webform submission handler for the 'next' 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.

1 call to WebformSubmissionForm::next()
WebformSubmissionForm::submit in src/WebformSubmissionForm.php
Webform submission handler for the 'submit' action.

File

src/WebformSubmissionForm.php, line 1556

Class

WebformSubmissionForm
Provides a webform to collect and edit submissions.

Namespace

Drupal\webform

Code

public function next(array &$form, FormStateInterface $form_state, $skip_preview = FALSE) {
  if ($form_state
    ->getErrors()) {
    return;
  }
  $pages = $this
    ->getPages($form, $form_state);

  // Get next page.
  $current_page = $this
    ->getCurrentPage($form, $form_state);
  $next_page = $this
    ->getNextPage($pages, $current_page);

  // If there is no next page jump to the confirmation page which will also
  // submit this form.
  // @see \Drupal\webform\WebformSubmissionForm::wizardSubmit
  if (empty($next_page)) {
    $next_page = WebformInterface::PAGE_CONFIRMATION;
  }

  // Skip preview page and move to the confirmation page.
  // @see
  if ($skip_preview && $next_page === WebformInterface::PAGE_PREVIEW) {
    $next_page = WebformInterface::PAGE_CONFIRMATION;
  }

  // Set next page.
  $form_state
    ->set('current_page', $next_page);

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