function EntityFormBuilder::getForm
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/EntityFormBuilder.php \Drupal\Core\Entity\EntityFormBuilder::getForm()
- 8.9.x core/lib/Drupal/Core/Entity/EntityFormBuilder.php \Drupal\Core\Entity\EntityFormBuilder::getForm()
- 10 core/lib/Drupal/Core/Entity/EntityFormBuilder.php \Drupal\Core\Entity\EntityFormBuilder::getForm()
Overrides EntityFormBuilderInterface::getForm
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityFormBuilder.php, line 43
Class
- EntityFormBuilder
- Builds entity forms.
Namespace
Drupal\Core\EntityCode
public function getForm(EntityInterface $entity, $operation = 'default', array $form_state_additions = []) {
$form_object = $this->entityTypeManager
->getFormObject($entity->getEntityTypeId(), $operation);
$form_object->setEntity($entity);
$form_state = (new FormState())->setFormState($form_state_additions);
return $this->formBuilder
->buildForm($form_object, $form_state);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.