1<?php
2
3namespace Drupal\Core\Render\Element;
4
5use Drupal\Core\Form\FormStateInterface;
6
7/**
8 * Provides an interface for form element plugins.
9 *
10 * Form element plugins are a subset of render elements, specifically
11 * representing HTML elements that take input as part of a form. Form element
12 * plugins are discovered via the same mechanism as regular render element
13 * plugins. See \Drupal\Core\Render\Element\ElementInterface for general
14 * information about render element plugins.
15 *
16 * @see \Drupal\Core\Render\ElementInfoManager
17 * @see \Drupal\Core\Render\Element\FormElement
18 * @see \Drupal\Core\Render\Annotation\FormElement
19 * @see plugin_api
20 *
21 * @ingroup theme_render
22 */
23interface FormElementInterface extends ElementInterface {
24
25  /**
26   * Determines how user input is mapped to an element's #value property.
27   *
28   * @param array $element
29   *   An associative array containing the properties of the element.
30   * @param mixed $input
31   *   The incoming input to populate the form element. If this is FALSE,
32   *   the element's default value should be returned.
33   * @param \Drupal\Core\Form\FormStateInterface $form_state
34   *   The current state of the form.
35   *
36   * @return mixed
37   *   The value to assign to the element.
38   */
39  public static function valueCallback(&$element, $input, FormStateInterface $form_state);
40
41}
42