protected function WorkflowAddForm::copyFormValuesToEntity in Drupal 8
Same name and namespace in other branches
- 9 core/modules/workflows/src/Form/WorkflowAddForm.php \Drupal\workflows\Form\WorkflowAddForm::copyFormValuesToEntity()
Copies top-level form values to entity properties
This should not change existing entity properties that are not being edited by this form.
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/ WorkflowAddForm.php, line 106
Class
- WorkflowAddForm
- Form for adding workflows.
Namespace
Drupal\workflows\FormCode
protected function copyFormValuesToEntity(EntityInterface $entity, array $form, FormStateInterface $form_state) {
// This form can only set the workflow's ID, label and the weights for each
// state.
/** @var \Drupal\workflows\WorkflowInterface $entity */
$values = $form_state
->getValues();
$entity
->set('label', $values['label']);
$entity
->set('id', $values['id']);
$entity
->set('type', $values['workflow_type']);
}