Provides an interface for a Form.

Implemented by

Hierarchy

Expanded class hierarchy of FormInterface

Related topics

File

core/lib/Drupal/Core/Form/FormInterface.php, line 15
Contains \Drupal\Core\Form\FormInterface.

Namespace

Drupal\Core\Form
View source
interface FormInterface {

  /**
   * Returns a unique string identifying the form.
   *
   * @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

Contains filters are case sensitive
Namesort descending Modifiers Type Description
FormInterface::buildForm public function Form constructor.
FormInterface::getFormId public function Returns a unique string identifying the form.
FormInterface::submitForm public function Form submission handler.
FormInterface::validateForm public function Form validation handler.