function EntityFormInterface::setEntity
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/EntityFormInterface.php \Drupal\Core\Entity\EntityFormInterface::setEntity()
- 8.9.x core/lib/Drupal/Core/Entity/EntityFormInterface.php \Drupal\Core\Entity\EntityFormInterface::setEntity()
- 11.x core/lib/Drupal/Core/Entity/EntityFormInterface.php \Drupal\Core\Entity\EntityFormInterface::setEntity()
Sets the form entity.
Sets the form entity which will be used for populating form element defaults. Usually, the form entity gets updated by \Drupal\Core\Entity\EntityFormInterface::submit(), however this may be used to completely exchange the form entity, e.g. when preparing the rebuild of a multi-step form.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity the current form should operate upon.
Return value
$this
3 methods override EntityFormInterface::setEntity()
- EntityForm::setEntity in core/
lib/ Drupal/ Core/ Entity/ EntityForm.php - Sets the form entity.
- RevisionDeleteForm::setEntity in core/
lib/ Drupal/ Core/ Entity/ Form/ RevisionDeleteForm.php - Sets the form entity.
- RevisionRevertForm::setEntity in core/
lib/ Drupal/ Core/ Entity/ Form/ RevisionRevertForm.php - Sets the form entity.
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityFormInterface.php, line 58
Class
- EntityFormInterface
- Defines an interface for entity form classes.
Namespace
Drupal\Core\EntityCode
public function setEntity(EntityInterface $entity);
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.