prepareInvokeAll example

/** * Initialize the form state and the entity before the first form build. */
  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);
  }

  /** * Gets the actual form array to be built. * * @see \Drupal\Core\Entity\EntityForm::processForm() * @see \Drupal\Core\Entity\EntityForm::afterBuild() */
  public function form(array $form, FormStateInterface $form_state) {
    // Add #process and #after_build callbacks.
Home | Imprint | This part of the site doesn't use cookies.