3 namespace Drupal\Core\Render\Element;
5 use Drupal\Component\Plugin\PluginInspectionInterface;
8 * Provides an interface for render element plugins.
10 * Render element plugins allow modules to declare their own Render API element
11 * types and specify the default values for the properties. The values returned
12 * by the getInfo() method of the element plugin will be merged with the
13 * properties specified in render arrays. Thus, you can specify defaults for any
14 * Render API keys, in addition to those explicitly documented by
15 * \Drupal\Core\Render\ElementInfoManagerInterface::getInfo().
17 * Some render elements are specifically form input elements; see
18 * \Drupal\Core\Render\Element\FormElementInterface for more information.
20 * @see \Drupal\Core\Render\ElementInfoManager
21 * @see \Drupal\Core\Render\Annotation\RenderElement
22 * @see \Drupal\Core\Render\Element\RenderElement
25 * @ingroup theme_render
27 interface ElementInterface extends PluginInspectionInterface {
30 * Returns the element properties for this element.
33 * An array of element properties. See
34 * \Drupal\Core\Render\ElementInfoManagerInterface::getInfo() for
35 * documentation of the standard properties of all elements, and the
36 * return value format.
38 public function getInfo();
41 * Sets a form element's class attribute.
43 * Adds 'required' and 'error' classes as needed.
45 * @param array $element
48 * Array of new class names to be added.
50 public static function setAttributes(&$element, $class = []);