Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
GetAttributes.php
Go to the documentation of this file.
1 <?php
8 
12 
14 {
20  const ADMIN_RESOURCE = 'Magento_Catalog::products';
21 
27  protected $storeManager;
28 
32  protected $jsonHelper;
33 
40  public function __construct(
41  Action\Context $context,
43  \Magento\Framework\Json\Helper\Data $jsonHelper,
44  AttributesListInterface $attributesList
45  ) {
46  $this->storeManager = $storeManager;
47  $this->jsonHelper = $jsonHelper;
48  $this->attributesList = $attributesList;
49  parent::__construct($context);
50  }
51 
57  public function execute()
58  {
59  $this->storeManager->setCurrentStore(\Magento\Store\Model\Store::ADMIN_CODE);
60  $attributes = $this->attributesList->getAttributes($this->getRequest()->getParam('attributes'));
61  $this->getResponse()->representJson($this->jsonHelper->jsonEncode($attributes));
62  }
63 }
__construct(Action\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Json\Helper\Data $jsonHelper, AttributesListInterface $attributesList)
$attributes
Definition: matrix.phtml:13