function EntityForm::prepareInvokeAll

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/EntityForm.php \Drupal\Core\Entity\EntityForm::prepareInvokeAll()
  2. 10 core/lib/Drupal/Core/Entity/EntityForm.php \Drupal\Core\Entity\EntityForm::prepareInvokeAll()
  3. 11.x core/lib/Drupal/Core/Entity/EntityForm.php \Drupal\Core\Entity\EntityForm::prepareInvokeAll()

Invokes the specified prepare hook variant.

Parameters

string $hook: The hook variant name.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

1 call to EntityForm::prepareInvokeAll()
EntityForm::init in core/lib/Drupal/Core/Entity/EntityForm.php
Initialize the form state and the entity before the first form build.

File

core/lib/Drupal/Core/Entity/EntityForm.php, line 389

Class

EntityForm
Base class for entity forms.

Namespace

Drupal\Core\Entity

Code

protected function prepareInvokeAll($hook, FormStateInterface $form_state) {
    $this->moduleHandler
        ->invokeAllWith($hook, function (callable $hook, string $module) use ($form_state) {
        // Ensure we pass an updated translation object and form display at
        // each invocation, since they depend on form state which is alterable.
        $hook($this->entity, $this->operation, $form_state);
    });
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.