Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Chooser.php
Go to the documentation of this file.
1 <?php
8 
11 use Magento\Framework\Controller\Result\RawFactory;
12 
14 {
18  const ADMIN_RESOURCE = 'Magento_Widget::widget_instance';
19 
23  protected $layoutFactory;
24 
28  protected $resultRawFactory;
29 
35  public function __construct(Context $context, LayoutFactory $layoutFactory, RawFactory $resultRawFactory)
36  {
37  $this->layoutFactory = $layoutFactory;
38  $this->resultRawFactory = $resultRawFactory;
39  parent::__construct($context);
40  }
41 
47  public function execute()
48  {
50  $layout = $this->layoutFactory->create();
51 
52  $uniqId = $this->getRequest()->getParam('uniq_id');
53  $pagesGrid = $layout->createBlock(
54  \Magento\Cms\Block\Adminhtml\Block\Widget\Chooser::class,
55  '',
56  ['data' => ['id' => $uniqId]]
57  );
58 
60  $resultRaw = $this->resultRawFactory->create();
61  $resultRaw->setContents($pagesGrid->toHtml());
62  return $resultRaw;
63  }
64 }
__construct(Context $context, LayoutFactory $layoutFactory, RawFactory $resultRawFactory)
Definition: Chooser.php:35