interface FormElementInterface

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Render/Element/FormElementInterface.php \Drupal\Core\Render\Element\FormElementInterface
  2. 10 core/lib/Drupal/Core/Render/Element/FormElementInterface.php \Drupal\Core\Render\Element\FormElementInterface
  3. 9 core/lib/Drupal/Core/Render/Element/FormElementInterface.php \Drupal\Core\Render\Element\FormElementInterface

Provides an interface for form element plugins.

Form element plugins are a subset of render elements, specifically representing HTML elements that take input as part of a form. Form element plugins are discovered via the same mechanism as regular render element plugins. See \Drupal\Core\Render\Element\ElementInterface for general information about render element plugins.

Hierarchy

  • interface \Drupal\Core\Render\Element\FormElementInterface extends \Drupal\Core\Render\Element\ElementInterface

Expanded class hierarchy of FormElementInterface

All classes that implement FormElementInterface

See also

\Drupal\Core\Render\ElementInfoManager

\Drupal\Core\Render\Element\FormElement

\Drupal\Core\Render\Annotation\FormElement

Plugin API

Related topics

1 file declares its use of FormElementInterface
ElementInfoManager.php in core/lib/Drupal/Core/Render/ElementInfoManager.php

File

core/lib/Drupal/Core/Render/Element/FormElementInterface.php, line 23

Namespace

Drupal\Core\Render\Element
View source
interface FormElementInterface extends ElementInterface {
  
  /**
   * Determines how user input is mapped to an element's #value property.
   *
   * @param array $element
   *   An associative array containing the properties of the element.
   * @param mixed $input
   *   The incoming input to populate the form element. If this is FALSE,
   *   the element's default value should be returned.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   *
   * @return mixed
   *   The value to assign to the element.
   */
  public static function valueCallback(&$element, $input, FormStateInterface $form_state);

}

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