public function FormsStepsStepDeleteForm::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/ FormsStepsStepDeleteForm.php, line 88
Class
- FormsStepsStepDeleteForm
- Builds the form to delete steps from FormsSteps entities.
Namespace
Drupal\forms_steps\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$forms_steps_label = $this->formsSteps
->getStep($this->stepId)
->label();
$this->formsSteps
->deleteStep($this->stepId)
->save();
// TODO: Check if there is a way to just update the current route ?!
/** @var \Drupal\Core\Routing\RouteBuilder $routeBuilderService */
$routeBuilderService = \Drupal::service('router.builder');
$routeBuilderService
->rebuild();
$this
->messenger()
->addMessage($this
->t('Step %label deleted.', [
'%label' => $forms_steps_label,
]));
$form_state
->setRedirectUrl($this
->getCancelUrl());
}