You are here

public function WebformVariantDeleteForm::submitForm in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Form/WebformVariantDeleteForm.php \Drupal\webform\Form\WebformVariantDeleteForm::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/WebformVariantDeleteForm.php, line 107

Class

WebformVariantDeleteForm
Form for deleting a webform variant.

Namespace

Drupal\webform\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->webform
    ->deleteWebformVariant($this->webformVariant);
  $this
    ->messenger()
    ->addStatus($this
    ->t('The webform variant %name has been deleted.', [
    '%name' => $this->webformVariant
      ->label(),
  ]));
  $form_state
    ->setRedirectUrl($this->webform
    ->toUrl('variants'));
}