You are here

public function WebformSubmissionsDeleteFormBase::submitForm in Webform 8.5

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

Form submission handler.

Parameters

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

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

Overrides FormInterface::submitForm

File

src/Form/WebformSubmissionsDeleteFormBase.php, line 102

Class

WebformSubmissionsDeleteFormBase
Base webform for deleting webform submission.

Namespace

Drupal\webform\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $form_state
    ->setRedirectUrl($this
    ->getCancelUrl());
  if ($this->submissionStorage
    ->getTotal($this->webform, $this->sourceEntity) < $this
    ->getBatchLimit()) {
    $this->submissionStorage
      ->deleteAll($this->webform, $this->sourceEntity);
    $this
      ->messenger()
      ->addStatus($this
      ->getFinishedMessage());
  }
  else {
    $this
      ->batchSet($this->webform, $this->sourceEntity);
  }
}