You are here

public function WorkflowTransitionForm::copyFormValuesToEntity in Workflow 8

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 ContentEntityForm::copyFormValuesToEntity

1 call to WorkflowTransitionForm::copyFormValuesToEntity()
WorkflowTransitionForm::buildEntity in src/Form/WorkflowTransitionForm.php
Builds an updated entity object based upon the submitted form values.

File

src/Form/WorkflowTransitionForm.php, line 150

Class

WorkflowTransitionForm
Provides a Transition Form to be used in the Workflow Widget.

Namespace

Drupal\workflow\Form

Code

public function copyFormValuesToEntity(EntityInterface $entity, array $form, FormStateInterface $form_state) {
  parent::copyFormValuesToEntity($entity, $form, $form_state);

  // Use a proprietary version of copyFormValuesToEntity(),
  // passing $entity by reference...
  $values = $form_state
    ->getValues();

  // ... but only the returning object is OK (!).
  return WorkflowTransitionElement::copyFormValuesToTransition($entity, $form, $form_state, $values);
}