Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Form/FormInterface.php \Drupal\Core\Form\FormInterface
  2. 9 core/lib/Drupal/Core/Form/FormInterface.php \Drupal\Core\Form\FormInterface

Provides an interface for a Form.

Hierarchy

Expanded class hierarchy of FormInterface

All classes that implement FormInterface

Related topics

35 files declare their use of FormInterface
ActionsTest.php in core/tests/Drupal/KernelTests/Core/Render/Element/ActionsTest.php
AjaxTestFocusFirstForm.php in core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestFocusFirstForm.php
AjaxTestMessageCommandForm.php in core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestMessageCommandForm.php
BlockListBuilder.php in core/modules/block/src/BlockListBuilder.php
DatelistElementFormTest.php in core/tests/Drupal/KernelTests/Core/Datetime/DatelistElementFormTest.php

... See full list

File

core/lib/Drupal/Core/Form/FormInterface.php, line 10

Namespace

Drupal\Core\Form
View source
interface FormInterface {

  /**
   * Returns a unique string identifying the form.
   *
   * The returned ID should be a unique string that can be a valid PHP function
   * name, since it's used in hook implementation names such as
   * hook_form_FORM_ID_alter().
   *
   * @return string
   *   The unique string identifying the form.
   */
  public function getFormId();

  /**
   * Form constructor.
   *
   * @param array $form
   *   An associative array containing the structure of the form.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   *
   * @return array
   *   The form structure.
   */
  public function buildForm(array $form, FormStateInterface $form_state);

  /**
   * Form validation handler.
   *
   * @param array $form
   *   An associative array containing the structure of the form.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   */
  public function validateForm(array &$form, FormStateInterface $form_state);

  /**
   * Form submission handler.
   *
   * @param array $form
   *   An associative array containing the structure of the form.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   */
  public function submitForm(array &$form, FormStateInterface $form_state);

}

Members

Namesort descending Modifiers Type Description Overrides
FormInterface::buildForm public function Form constructor. 189
FormInterface::getFormId public function Returns a unique string identifying the form. 223
FormInterface::submitForm public function Form submission handler. 209
FormInterface::validateForm public function Form validation handler. 32