ElementInfoManagerInterface.php 2.5 KB

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