On this page
protected function EntityForm::init
protected EntityForm::init(FormStateInterface $form_state)
Initialize the form state and the entity before the first form build.
File
- core/lib/Drupal/Core/Entity/EntityForm.php, line 129
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);
}
© 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!EntityForm.php/function/EntityForm::init/8.1.x