function WorkflowTransitionEditForm::copyFormValuesToEntity
Same name in other branches
- 9 core/modules/workflows/src/Form/WorkflowTransitionEditForm.php \Drupal\workflows\Form\WorkflowTransitionEditForm::copyFormValuesToEntity()
- 10 core/modules/workflows/src/Form/WorkflowTransitionEditForm.php \Drupal\workflows\Form\WorkflowTransitionEditForm::copyFormValuesToEntity()
- 11.x core/modules/workflows/src/Form/WorkflowTransitionEditForm.php \Drupal\workflows\Form\WorkflowTransitionEditForm::copyFormValuesToEntity()
Copies top-level form values to entity properties
This form can only change values for a state, which is part of workflow.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity the current form should operate upon.
array $form: A nested array of form elements comprising the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides EntityForm::copyFormValuesToEntity
File
-
core/
modules/ workflows/ src/ Form/ WorkflowTransitionEditForm.php, line 171
Class
- WorkflowTransitionEditForm
- Class WorkflowTransitionEditForm.
Namespace
Drupal\workflows\FormCode
protected function copyFormValuesToEntity(EntityInterface $entity, array $form, FormStateInterface $form_state) {
if (!$form_state->isValidationComplete()) {
// Only do something once form validation is complete.
return;
}
/** @var \Drupal\workflows\WorkflowInterface $entity */
$values = $form_state->getValues();
$form_state->set('created_transition', FALSE);
$entity->getTypePlugin()
->setTransitionLabel($values['id'], $values['label']);
$entity->getTypePlugin()
->setTransitionFromStates($values['id'], array_filter($values['from']));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.