function WorkflowStateEditForm::save
Same name in other branches
- 9 core/modules/workflows/src/Form/WorkflowStateEditForm.php \Drupal\workflows\Form\WorkflowStateEditForm::save()
- 10 core/modules/workflows/src/Form/WorkflowStateEditForm.php \Drupal\workflows\Form\WorkflowStateEditForm::save()
- 11.x core/modules/workflows/src/Form/WorkflowStateEditForm.php \Drupal\workflows\Form\WorkflowStateEditForm::save()
Overrides EntityForm::save
File
-
core/
modules/ workflows/ src/ Form/ WorkflowStateEditForm.php, line 194
Class
- WorkflowStateEditForm
- Class WorkflowStateEditForm.
Namespace
Drupal\workflows\FormCode
public function save(array $form, FormStateInterface $form_state) {
/** @var \Drupal\workflows\WorkflowInterface $workflow */
$workflow = $this->entity;
$workflow_type = $workflow->getTypePlugin();
if ($workflow_type->hasFormClass(StateInterface::PLUGIN_FORM_KEY)) {
$subform_state = SubformState::createForSubform($form['type_settings'], $form, $form_state);
$subform_state->set('state', $workflow_type->getState($this->stateId));
$this->pluginFormFactory
->createInstance($workflow_type, StateInterface::PLUGIN_FORM_KEY)
->submitConfigurationForm($form['type_settings'], $subform_state);
}
$workflow->save();
$this->messenger()
->addStatus($this->t('Saved %label state.', [
'%label' => $workflow->getTypePlugin()
->getState($this->stateId)
->label(),
]));
$form_state->setRedirectUrl($workflow->toUrl('edit-form'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.