public function WorkflowStateDeleteForm::submitForm in Drupal 9
Same name and namespace in other branches
- 8 core/modules/workflows/src/Form/WorkflowStateDeleteForm.php \Drupal\workflows\Form\WorkflowStateDeleteForm::submitForm()
- 10 core/modules/workflows/src/Form/WorkflowStateDeleteForm.php \Drupal\workflows\Form\WorkflowStateDeleteForm::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/ WorkflowStateDeleteForm.php, line 93
Class
- WorkflowStateDeleteForm
- Builds the form to delete states from Workflow entities.
Namespace
Drupal\workflows\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$workflow_label = $this->workflow
->getTypePlugin()
->getState($this->stateId)
->label();
$this->workflow
->getTypePlugin()
->deleteState($this->stateId);
$this->workflow
->save();
$this
->messenger()
->addStatus($this
->t('State %label deleted.', [
'%label' => $workflow_label,
]));
$form_state
->setRedirectUrl($this
->getCancelUrl());
}