Proxy.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Config\Model\Config\Structure\Element\Group;
  7. /**
  8. * @api
  9. * @since 100.0.2
  10. */
  11. class Proxy extends \Magento\Config\Model\Config\Structure\Element\Group implements
  12. \Magento\Framework\ObjectManager\NoninterceptableInterface
  13. {
  14. /**
  15. * Object manager
  16. * @var \Magento\Framework\ObjectManagerInterface
  17. */
  18. protected $_objectManager;
  19. /**
  20. * @var \Magento\Config\Model\Config\Structure\Element\Group
  21. */
  22. protected $_subject;
  23. /**
  24. * @param \Magento\Framework\ObjectManagerInterface $objectManger
  25. */
  26. public function __construct(\Magento\Framework\ObjectManagerInterface $objectManger)
  27. {
  28. $this->_objectManager = $objectManger;
  29. }
  30. /**
  31. * Retrieve subject
  32. *
  33. * @return \Magento\Config\Model\Config\Structure\Element\Group
  34. */
  35. protected function _getSubject()
  36. {
  37. if (!$this->_subject) {
  38. $this->_subject = $this->_objectManager->create(
  39. \Magento\Config\Model\Config\Structure\Element\Group::class
  40. );
  41. }
  42. return $this->_subject;
  43. }
  44. /**
  45. * Set element data
  46. *
  47. * @param array $data
  48. * @param string $scope
  49. * @return void
  50. */
  51. public function setData(array $data, $scope)
  52. {
  53. $this->_getSubject()->setData($data, $scope);
  54. }
  55. /**
  56. * Retrieve element id
  57. *
  58. * @return string
  59. */
  60. public function getId()
  61. {
  62. return $this->_getSubject()->getId();
  63. }
  64. /**
  65. * Retrieve element label
  66. *
  67. * @return string
  68. */
  69. public function getLabel()
  70. {
  71. return $this->_getSubject()->getLabel();
  72. }
  73. /**
  74. * Retrieve element label
  75. *
  76. * @return string
  77. */
  78. public function getComment()
  79. {
  80. return $this->_getSubject()->getComment();
  81. }
  82. /**
  83. * Retrieve frontend model class name
  84. *
  85. * @return string
  86. */
  87. public function getFrontendModel()
  88. {
  89. return $this->_getSubject()->getFrontendModel();
  90. }
  91. /**
  92. * Retrieve arbitrary element attribute
  93. *
  94. * @param string $key
  95. * @return mixed
  96. */
  97. public function getAttribute($key)
  98. {
  99. return $this->_getSubject()->getAttribute($key);
  100. }
  101. /**
  102. * Check whether section is allowed for current user
  103. *
  104. * @return bool
  105. */
  106. public function isAllowed()
  107. {
  108. return $this->_getSubject()->isAllowed();
  109. }
  110. /**
  111. * Check whether element should be displayed
  112. *
  113. * @param string $websiteCode
  114. * @param string $storeCode
  115. * @return bool
  116. */
  117. public function isVisible($websiteCode = '', $storeCode = '')
  118. {
  119. return $this->_getSubject()->isVisible($websiteCode, $storeCode);
  120. }
  121. /**
  122. * Retrieve css class of a tab
  123. *
  124. * @return string
  125. */
  126. public function getClass()
  127. {
  128. return $this->_getSubject()->getClass();
  129. }
  130. /**
  131. * Check whether element has visible child elements
  132. *
  133. * @return bool
  134. */
  135. public function hasChildren()
  136. {
  137. return $this->_getSubject()->hasChildren();
  138. }
  139. /**
  140. * Retrieve children iterator
  141. *
  142. * @return \Magento\Config\Model\Config\Structure\Element\Iterator
  143. */
  144. public function getChildren()
  145. {
  146. return $this->_getSubject()->getChildren();
  147. }
  148. /**
  149. * Should group fields be cloned
  150. *
  151. * @return bool
  152. */
  153. public function shouldCloneFields()
  154. {
  155. return $this->_getSubject()->shouldCloneFields();
  156. }
  157. /**
  158. * Retrieve clone model
  159. *
  160. * @return \Magento\Framework\Model\AbstractModel
  161. */
  162. public function getCloneModel()
  163. {
  164. return $this->_getSubject()->getCloneModel();
  165. }
  166. /**
  167. * Populate form fieldset with group data
  168. *
  169. * @param \Magento\Framework\Data\Form\Element\Fieldset $fieldset
  170. * @return void
  171. */
  172. public function populateFieldset(\Magento\Framework\Data\Form\Element\Fieldset $fieldset)
  173. {
  174. $this->_getSubject()->populateFieldset($fieldset);
  175. }
  176. /**
  177. * Retrieve element data
  178. *
  179. * @return array
  180. */
  181. public function getData()
  182. {
  183. return $this->_getSubject()->getData();
  184. }
  185. /**
  186. * Retrieve element path
  187. *
  188. * @param string $fieldPrefix
  189. * @return string
  190. */
  191. public function getPath($fieldPrefix = '')
  192. {
  193. return $this->_getSubject()->getPath($fieldPrefix);
  194. }
  195. /**
  196. * Check whether element should be expanded
  197. *
  198. * @return bool
  199. */
  200. public function isExpanded()
  201. {
  202. return $this->_getSubject()->isExpanded();
  203. }
  204. /**
  205. * Retrieve fieldset css
  206. *
  207. * @return string
  208. */
  209. public function getFieldsetCss()
  210. {
  211. return $this->_getSubject()->getFieldsetCss();
  212. }
  213. /**
  214. * Retrieve element dependencies
  215. *
  216. * @param string $storeCode
  217. * @return array
  218. */
  219. public function getDependencies($storeCode)
  220. {
  221. return $this->_getSubject()->getDependencies($storeCode);
  222. }
  223. }