ContextInterface.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\View\Element\UiComponent;
  7. use Magento\Framework\View\Element\UiComponentInterface;
  8. use Magento\Framework\View\Element\UiComponent\ContentType\ContentTypeInterface;
  9. use Magento\Framework\View\Element\UiComponent\DataProvider\DataProviderInterface;
  10. use Magento\Framework\View\LayoutInterface as PageLayoutInterface;
  11. use Magento\Framework\View\Element\UiComponentFactory;
  12. /**
  13. * Interface ContextInterface
  14. */
  15. interface ContextInterface
  16. {
  17. /**
  18. * Filter variable name
  19. */
  20. const FILTER_VAR = 'filters';
  21. /**
  22. * Add components definition
  23. *
  24. * @param string $name
  25. * @param array $config
  26. * @return void
  27. */
  28. public function addComponentDefinition($name, array $config);
  29. /**
  30. * Get components definitions
  31. *
  32. * @return array
  33. */
  34. public function getComponentsDefinitions();
  35. /**
  36. * Getting root component name
  37. *
  38. * @return string
  39. */
  40. public function getNamespace();
  41. /**
  42. * Getting accept type
  43. *
  44. * @return string
  45. */
  46. public function getAcceptType();
  47. /**
  48. * Set data provider
  49. *
  50. * @param DataProviderInterface $dataProvider
  51. * @return void
  52. */
  53. public function setDataProvider(DataProviderInterface $dataProvider);
  54. /**
  55. * Get data provider
  56. *
  57. * @return DataProviderInterface
  58. */
  59. public function getDataProvider();
  60. /**
  61. * Get Data Source array
  62. *
  63. * @param UiComponentInterface $component
  64. * @return array
  65. */
  66. public function getDataSourceData(UiComponentInterface $component);
  67. /**
  68. * Getting all request data
  69. *
  70. * @return mixed
  71. */
  72. public function getRequestParams();
  73. /**
  74. * Getting data according to the key
  75. *
  76. * @param string $key
  77. * @param mixed|null $defaultValue
  78. * @return mixed
  79. */
  80. public function getRequestParam($key, $defaultValue = null);
  81. /**
  82. * Get filters params
  83. *
  84. * @return array
  85. */
  86. public function getFiltersParams();
  87. /**
  88. * Get filter params according to the key
  89. *
  90. * @param string $key
  91. * @param null|string $defaultValue
  92. * @return mixed|null
  93. */
  94. public function getFilterParam($key, $defaultValue = null);
  95. /**
  96. * Get root layout
  97. *
  98. * @return PageLayoutInterface
  99. */
  100. public function getPageLayout();
  101. /**
  102. * Add button in the actions toolbar
  103. *
  104. * @param array $buttons
  105. * @param UiComponentInterface $component
  106. * @return void
  107. */
  108. public function addButtons(array $buttons, UiComponentInterface $component);
  109. /**
  110. * Add html block in the actions toolbar
  111. *
  112. * @param array $htmlBlocks
  113. * @param UiComponentInterface $component
  114. * @return void
  115. */
  116. public function addHtmlBlocks(array $htmlBlocks, UiComponentInterface $component);
  117. /**
  118. * Get render engine
  119. *
  120. * @return ContentTypeInterface
  121. */
  122. public function getRenderEngine();
  123. /**
  124. * Generate url by route and parameters
  125. *
  126. * @param string $route
  127. * @param array $params
  128. * @return string
  129. */
  130. public function getUrl($route = '', $params = []);
  131. /**
  132. * Get component processor
  133. *
  134. * @return Processor
  135. */
  136. public function getProcessor();
  137. /**
  138. * Get Ui Component Factory
  139. *
  140. * @return UiComponentFactory
  141. */
  142. public function getUiComponentFactory();
  143. }