You are here

public function WebformSubmissionsDeleteFormBase::submitForm in Webform 6.x

Same name and namespace in other branches
  1. 8.5 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 82

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
    ->getSubmissionStorage()
    ->getTotal($this->webform, $this->sourceEntity) < $this
    ->getBatchLimit()) {
    $this
      ->getSubmissionStorage()
      ->deleteAll($this->webform, $this->sourceEntity);
    $this
      ->messenger()
      ->addStatus($this
      ->getFinishedMessage());
  }
  else {
    $this
      ->batchSet($this->webform, $this->sourceEntity);
  }
}