function EntityForm::init
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Entity/EntityForm.php \Drupal\Core\Entity\EntityForm::init()
- 10 core/lib/Drupal/Core/Entity/EntityForm.php \Drupal\Core\Entity\EntityForm::init()
- 8.9.x core/lib/Drupal/Core/Entity/EntityForm.php \Drupal\Core\Entity\EntityForm::init()
Initialize the form state and the entity before the first form build.
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityForm.php, line 120
Class
- EntityForm
- Base class for entity forms.
Namespace
Drupal\Core\EntityCode
protected function init(FormStateInterface $form_state) {
// Flag that this form has been initialized.
$form_state->set('entity_form_initialized', TRUE);
// Prepare the entity to be presented in the entity form.
$this->prepareEntity();
// Invoke the prepare form hooks.
$this->prepareInvokeAll('entity_prepare_form', $form_state);
$this->prepareInvokeAll($this->entity
->getEntityTypeId() . '_prepare_form', $form_state);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.