public ContentEntityForm::buildEntity(array $form, FormStateInterface $form_state)
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.
array $form: A nested array form elements comprising the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
\Drupal\Core\Entity\EntityInterface An updated copy of the form's entity object.
Overrides EntityForm::buildEntity
\Drupal\Core\Entity\EntityFormInterface::getEntity()
public function buildEntity(array $form, FormStateInterface $form_state) { /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */ $entity = parent::buildEntity($form, $form_state); // Mark the entity as requiring validation. $entity->setValidationRequired(!$form_state->getTemporaryValue('entity_validated')); return $entity; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!ContentEntityForm.php/function/ContentEntityForm::buildEntity/8.1.x