99b7dacc5fef40e7d54d9640c16d886a4db429c5
[yaffs-website] / web / core / lib / Drupal / Core / Render / ElementInfoManagerInterface.php
1 <?php
2
3 namespace Drupal\Core\Render;
4
5 use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
6
7 /**
8  * Collects available render array element types.
9  */
10 interface ElementInfoManagerInterface extends DiscoveryInterface {
11
12   /**
13    * Retrieves the default properties for the defined element type.
14    *
15    * Each of the element types defined by this hook is assumed to have a
16    * matching theme hook, which should be registered with hook_theme() as
17    * normal.
18    *
19    * For more information about custom element types see the explanation at
20    * https://www.drupal.org/node/169815.
21    *
22    * @param string $type
23    *   The machine name of an element type plugin.
24    *
25    * @return array
26    *   An associative array describing the element types being defined. The
27    *   array contains a sub-array for each element type, with the
28    *   machine-readable type name as the key. Each sub-array has a number of
29    *   possible attributes:
30    *   - #input: boolean indicating whether or not this element carries a value
31    *     (even if it's hidden).
32    *   - #process: array of callback functions taking $element, $form_state,
33    *     and $complete_form.
34    *   - #after_build: array of callables taking $element and $form_state.
35    *   - #validate: array of callback functions taking $form and $form_state.
36    *   - #element_validate: array of callback functions taking $element and
37    *     $form_state.
38    *   - #pre_render: array of callables taking $element.
39    *   - #post_render: array of callables taking $children and $element.
40    *   - #submit: array of callback functions taking $form and $form_state.
41    *   - #title_display: optional string indicating if and how #title should be
42    *     displayed (see form-element.html.twig).
43    *
44    * @see \Drupal\Core\Render\Element\ElementInterface
45    * @see \Drupal\Core\Render\Element\ElementInterface::getInfo()
46    */
47   public function getInfo($type);
48
49   /**
50    * Retrieves a single property for the defined element type.
51    *
52    * @param string $type
53    *   An element type as defined by an element plugin.
54    * @param string $property_name
55    *   The property within the element type that should be returned.
56    * @param $default
57    *   (Optional) The value to return if the element type does not specify a
58    *   value for the property. Defaults to NULL.
59    *
60    * @return string
61    *   The property value of the defined element type. Or the provided
62    *   default value, which can be NULL.
63    */
64   public function getInfoProperty($type, $property_name, $default = NULL);
65
66 }