Index.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Cms\Controller\Adminhtml\Wysiwyg\Images;
  8. class Index extends \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images
  9. {
  10. /**
  11. * @var \Magento\Framework\View\Result\LayoutFactory
  12. */
  13. protected $resultLayoutFactory;
  14. /**
  15. * @param \Magento\Backend\App\Action\Context $context
  16. * @param \Magento\Framework\Registry $coreRegistry
  17. * @param \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory
  18. */
  19. public function __construct(
  20. \Magento\Backend\App\Action\Context $context,
  21. \Magento\Framework\Registry $coreRegistry,
  22. \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory
  23. ) {
  24. $this->resultLayoutFactory = $resultLayoutFactory;
  25. parent::__construct($context, $coreRegistry);
  26. }
  27. /**
  28. * Index action
  29. *
  30. * @return \Magento\Framework\Controller\ResultInterface
  31. */
  32. public function execute()
  33. {
  34. $storeId = (int)$this->getRequest()->getParam('store');
  35. try {
  36. $this->_objectManager->get(\Magento\Cms\Helper\Wysiwyg\Images::class)->getCurrentPath();
  37. } catch (\Exception $e) {
  38. $this->messageManager->addErrorMessage($e->getMessage());
  39. }
  40. $this->_initAction();
  41. /** @var \Magento\Framework\View\Result\Layout $resultLayout */
  42. $resultLayout = $this->resultLayoutFactory->create();
  43. $resultLayout->addHandle('overlay_popup');
  44. $block = $resultLayout->getLayout()->getBlock('wysiwyg_images.js');
  45. if ($block) {
  46. $block->setStoreId($storeId);
  47. }
  48. return $resultLayout;
  49. }
  50. }