Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SuggestConfigurableAttributes.php
Go to the documentation of this file.
1 <?php
8 
11 
13 {
19  const ADMIN_RESOURCE = 'Magento_Catalog::products';
20 
24  protected $attributeList;
25 
29  protected $jsonHelper;
30 
36  protected $storeManager;
37 
44  public function __construct(
45  Action\Context $context,
47  \Magento\Framework\Json\Helper\Data $jsonHelper,
49  ) {
50  $this->attributeList = $attributeList;
51  $this->jsonHelper = $jsonHelper;
52  $this->storeManager = $storeManager;
53  parent::__construct($context);
54  }
55 
61  public function execute()
62  {
63  $this->storeManager->setCurrentStore(\Magento\Store\Model\Store::ADMIN_CODE);
64 
65  $this->getResponse()->representJson(
66  $this->jsonHelper->jsonEncode(
67  $this->attributeList->getSuggestedAttributes($this->getRequest()->getParam('label_part'))
68  )
69  );
70  }
71 }
__construct(Action\Context $context, SuggestedAttributeList $attributeList, \Magento\Framework\Json\Helper\Data $jsonHelper, \Magento\Store\Model\StoreManagerInterface $storeManager)