12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- /**
- *
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Cms\Controller\Adminhtml\Block\Widget;
- use Magento\Backend\App\Action\Context;
- use Magento\Framework\View\LayoutFactory;
- use Magento\Framework\Controller\Result\RawFactory;
- class Chooser extends \Magento\Backend\App\Action
- {
- /**
- * Authorization level of a basic admin session
- */
- const ADMIN_RESOURCE = 'Magento_Widget::widget_instance';
- /**
- * @var \Magento\Framework\View\LayoutFactory
- */
- protected $layoutFactory;
- /**
- * @var RawFactory
- */
- protected $resultRawFactory;
- /**
- * @param Context $context
- * @param LayoutFactory $layoutFactory
- * @param RawFactory $resultRawFactory
- */
- public function __construct(Context $context, LayoutFactory $layoutFactory, RawFactory $resultRawFactory)
- {
- $this->layoutFactory = $layoutFactory;
- $this->resultRawFactory = $resultRawFactory;
- parent::__construct($context);
- }
- /**
- * Chooser Source action
- *
- * @return \Magento\Framework\Controller\ResultInterface
- */
- public function execute()
- {
- /** @var \Magento\Framework\View\Layout $layout */
- $layout = $this->layoutFactory->create();
- $uniqId = $this->getRequest()->getParam('uniq_id');
- $pagesGrid = $layout->createBlock(
- \Magento\Cms\Block\Adminhtml\Block\Widget\Chooser::class,
- '',
- ['data' => ['id' => $uniqId]]
- );
- /** @var \Magento\Framework\Controller\Result\Raw $resultRaw */
- $resultRaw = $this->resultRawFactory->create();
- $resultRaw->setContents($pagesGrid->toHtml());
- return $resultRaw;
- }
- }
|