UiComponentInterface.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\View\Element;
  7. use Magento\Framework\View\Element\UiComponent\ContextInterface;
  8. /**
  9. * Interface UiComponentInterface
  10. *
  11. * @api
  12. * @since 100.0.2
  13. */
  14. interface UiComponentInterface extends BlockInterface
  15. {
  16. /**
  17. * Get component instance name
  18. *
  19. * @return string
  20. */
  21. public function getName();
  22. /**
  23. * Get component name
  24. *
  25. * @return string
  26. */
  27. public function getComponentName();
  28. /**
  29. * Get component configuration
  30. *
  31. * @return array
  32. */
  33. public function getConfiguration();
  34. /**
  35. * Render component
  36. *
  37. * @return string
  38. */
  39. public function render();
  40. /**
  41. * Add component
  42. *
  43. * @param string $name
  44. * @param UiComponentInterface $component
  45. * @return void
  46. */
  47. public function addComponent($name, UiComponentInterface $component);
  48. /**
  49. * @param string $name
  50. * @return UiComponentInterface
  51. */
  52. public function getComponent($name);
  53. /**
  54. * Get child components
  55. *
  56. * @return UiComponentInterface[]
  57. */
  58. public function getChildComponents();
  59. /**
  60. * Get template
  61. *
  62. * @return string
  63. */
  64. public function getTemplate();
  65. /**
  66. * Get component context
  67. *
  68. * @return ContextInterface
  69. */
  70. public function getContext();
  71. /**
  72. * Render child component
  73. *
  74. * @param string $name
  75. * @return string
  76. */
  77. public function renderChildComponent($name);
  78. /**
  79. * Component data setter
  80. *
  81. * @param string|array $key
  82. * @param mixed $value
  83. * @return void
  84. */
  85. public function setData($key, $value = null);
  86. /**
  87. * Component data getter
  88. *
  89. * @param string $key
  90. * @param string|int $index
  91. * @return mixed
  92. */
  93. public function getData($key = '', $index = null);
  94. /**
  95. * Prepare component configuration
  96. *
  97. * @return void
  98. */
  99. public function prepare();
  100. /**
  101. * Prepare Data Source
  102. *
  103. * @param array $dataSource
  104. * @return array
  105. */
  106. public function prepareDataSource(array $dataSource);
  107. /**
  108. * Get Data Source data
  109. *
  110. * @return array
  111. */
  112. public function getDataSourceData();
  113. }