function WorkflowTransitionAddForm::copyFormValuesToEntity
Same name in other branches
- 9 core/modules/workflows/src/Form/WorkflowTransitionAddForm.php \Drupal\workflows\Form\WorkflowTransitionAddForm::copyFormValuesToEntity()
- 10 core/modules/workflows/src/Form/WorkflowTransitionAddForm.php \Drupal\workflows\Form\WorkflowTransitionAddForm::copyFormValuesToEntity()
- 11.x core/modules/workflows/src/Form/WorkflowTransitionAddForm.php \Drupal\workflows\Form\WorkflowTransitionAddForm::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/ WorkflowTransitionAddForm.php, line 137
Class
- WorkflowTransitionAddForm
- Class WorkflowTransitionAddForm.
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();
$entity->getTypePlugin()
->addTransition($values['id'], $values['label'], array_filter($values['from']), $values['to']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.