function FormBuilderInterface::prepareForm

Same name in other branches
  1. 9 core/lib/Drupal/Core/Form/FormBuilderInterface.php \Drupal\Core\Form\FormBuilderInterface::prepareForm()
  2. 8.9.x core/lib/Drupal/Core/Form/FormBuilderInterface.php \Drupal\Core\Form\FormBuilderInterface::prepareForm()
  3. 11.x core/lib/Drupal/Core/Form/FormBuilderInterface.php \Drupal\Core\Form\FormBuilderInterface::prepareForm()

Prepares a structured form array.

Adds required elements, executes any hook_form_alter functions, and optionally inserts a validation token to prevent tampering.

Parameters

string $form_id: A unique string identifying the form for validation, submission, theming, and hook_form_alter functions.

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Passed in here so that hook_form_alter() calls can use it, as well.

File

core/lib/Drupal/Core/Form/FormBuilderInterface.php, line 242

Class

FormBuilderInterface
Provides an interface for form building and processing.

Namespace

Drupal\Core\Form

Code

public function prepareForm($form_id, &$form, FormStateInterface &$form_state);

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