function WorkflowAddForm::copyFormValuesToEntity

Same name and namespace in other branches
  1. 9 core/modules/workflows/src/Form/WorkflowAddForm.php \Drupal\workflows\Form\WorkflowAddForm::copyFormValuesToEntity()
  2. 10 core/modules/workflows/src/Form/WorkflowAddForm.php \Drupal\workflows\Form\WorkflowAddForm::copyFormValuesToEntity()
  3. 11.x core/modules/workflows/src/Form/WorkflowAddForm.php \Drupal\workflows\Form\WorkflowAddForm::copyFormValuesToEntity()

Overrides EntityForm::copyFormValuesToEntity

File

core/modules/workflows/src/Form/WorkflowAddForm.php, line 106

Class

WorkflowAddForm
Form for adding workflows.

Namespace

Drupal\workflows\Form

Code

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']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.