Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Reload.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
10 
14 class Reload extends \Magento\Catalog\Controller\Adminhtml\Product implements HttpPostActionInterface
15 {
19  public function execute()
20  {
21  if (!$this->getRequest()->getParam('set')) {
22  return $this->resultFactory->create(ResultFactory::TYPE_FORWARD)->forward('noroute');
23  }
24 
25  $product = $this->productBuilder->build($this->getRequest());
26 
28  $resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
29  $resultLayout->getLayout()->getUpdate()->addHandle(['catalog_product_' . $product->getTypeId()]);
30  $resultLayout->getLayout()->getUpdate()->removeHandle('default');
31  $resultLayout->setHeader('Content-Type', 'application/json', true);
32  return $resultLayout;
33  }
34 }