You are here

public function YamlFormSubmissionsDeleteFormBase::submitForm in YAML Form 8

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/YamlFormSubmissionsDeleteFormBase.php, line 94

Class

YamlFormSubmissionsDeleteFormBase
Base form for deleting form submission.

Namespace

Drupal\yamlform\Form

Code

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