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\Entity

Code

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);
}
doc_Drupal
2016-10-29 09:06:08
Comments
Leave a Comment

Please login to continue.