Version 1
[yaffs-website] / web / core / lib / Drupal / Core / Render / Element / ElementInterface.php
1 <?php
2
3 namespace Drupal\Core\Render\Element;
4
5 use Drupal\Component\Plugin\PluginInspectionInterface;
6
7 /**
8  * Provides an interface for render element plugins.
9  *
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().
16  *
17  * Some render elements are specifically form input elements; see
18  * \Drupal\Core\Render\Element\FormElementInterface for more information.
19  *
20  * @see \Drupal\Core\Render\ElementInfoManager
21  * @see \Drupal\Core\Render\Annotation\RenderElement
22  * @see \Drupal\Core\Render\Element\RenderElement
23  * @see plugin_api
24  *
25  * @ingroup theme_render
26  */
27 interface ElementInterface extends PluginInspectionInterface {
28
29   /**
30    * Returns the element properties for this element.
31    *
32    * @return array
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.
37    */
38   public function getInfo();
39
40   /**
41    * Sets a form element's class attribute.
42    *
43    * Adds 'required' and 'error' classes as needed.
44    *
45    * @param array $element
46    *   The form element.
47    * @param array $class
48    *   Array of new class names to be added.
49    */
50   public static function setAttributes(&$element, $class = []);
51
52 }