interface FormElementInterface

Same name in other branches
  1. 9 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. 11.x 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\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);

}

Members

Title Sort descending Modifiers Object type Summary Overrides
ElementInterface::getInfo public function Returns the element properties for this element. 56
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. 6
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2

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