You are here

public function WebformSubmissionForm::buildEntity in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/WebformSubmissionForm.php \Drupal\webform\WebformSubmissionForm::buildEntity()

Builds an updated entity object based upon the submitted form values.

For building the updated entity object the form's entity is cloned and the submitted form values are copied to entity properties. The form's entity remains unchanged.

Parameters

array $form: A nested array form elements comprising the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

\Drupal\Core\Entity\EntityInterface An updated copy of the form's entity object.

Overrides ContentEntityForm::buildEntity

See also

\Drupal\Core\Entity\EntityFormInterface::getEntity()

1 call to WebformSubmissionForm::buildEntity()
WebformSubmissionForm::validateForm in src/WebformSubmissionForm.php
Button-level validation handlers are highly discouraged for entity forms, as they will prevent entity validation from running. If the entity is going to be saved during the form submission, this method should be manually invoked from the button-level…

File

src/WebformSubmissionForm.php, line 525

Class

WebformSubmissionForm
Provides a webform to collect and edit submissions.

Namespace

Drupal\webform

Code

public function buildEntity(array $form, FormStateInterface $form_state) {

  /** @var \Drupal\webform\WebformSubmissionInterface $entity */
  $entity = parent::buildEntity($form, $form_state);

  // Override settings.
  $this
    ->overrideSettings($entity);
  return $entity;
}