Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Render/Element/FormElementInterface.php \Drupal\Core\Render\Element\FormElementInterface
  2. 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

Expanded class hierarchy of FormElementInterface

All classes that implement FormElementInterface

See also

\Drupal\Core\Render\ElementInfoManager

\Drupal\Core\Render\Element\FormElement

\Drupal\Core\Render\Attribute\FormElement

Plugin API

Related topics

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);

}

Members

Namesort descending Modifiers Type Description Overrides
ElementInterface::getInfo public function Returns the element properties for this element. 57
ElementInterface::setAttributes public static function Sets a form element's class attribute. 1
FormElementInterface::valueCallback public static function Determines how user input is mapped to an element's #value property. 1
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2