You are here

public function FormsStepsProgressStepDeleteForm::submitForm in Forms Steps 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/FormsStepsProgressStepDeleteForm.php, line 88

Class

FormsStepsProgressStepDeleteForm
Builds the form to delete progress steps from FormsSteps entities.

Namespace

Drupal\forms_steps\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $forms_steps_label = $this->formsSteps
    ->getProgressStep($this->progressStepId)
    ->label();
  $this->formsSteps
    ->deleteProgressStep($this->progressStepId)
    ->save();
  $this
    ->messenger()
    ->addMessage($this
    ->t('progress step %label deleted.', [
    '%label' => $forms_steps_label,
  ]));
  $form_state
    ->setRedirectUrl($this
    ->getCancelUrl());
}