function WorkflowTransitionDeleteForm::submitForm

Same name and namespace in other branches
  1. 9 core/modules/workflows/src/Form/WorkflowTransitionDeleteForm.php \Drupal\workflows\Form\WorkflowTransitionDeleteForm::submitForm()
  2. 8.9.x core/modules/workflows/src/Form/WorkflowTransitionDeleteForm.php \Drupal\workflows\Form\WorkflowTransitionDeleteForm::submitForm()
  3. 10 core/modules/workflows/src/Form/WorkflowTransitionDeleteForm.php \Drupal\workflows\Form\WorkflowTransitionDeleteForm::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

core/modules/workflows/src/Form/WorkflowTransitionDeleteForm.php, line 95

Class

WorkflowTransitionDeleteForm
Builds the form to delete transitions from Workflow entities.

Namespace

Drupal\workflows\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->workflow
    ->getTypePlugin()
    ->deleteTransition($this->transition
    ->id());
  $this->workflow
    ->save();
  $this->messenger()
    ->addStatus($this->t('%transition transition deleted.', [
    '%transition' => $this->transition
      ->label(),
  ]));
  $form_state->setRedirectUrl($this->getCancelUrl());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.