Files
esun3d/app/code/Esun/LegacyOrder/Controller/Adminhtml/Order/Modal.php
T
2026-09-15 10:35:56 +08:00

35 lines
1018 B
PHP

<?php
declare(strict_types=1);
namespace Esun\LegacyOrder\Controller\Adminhtml\Order;
use Esun\LegacyOrder\Block\Adminhtml\Order\View as ViewBlock;
use Magento\Backend\App\Action;
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\View\LayoutFactory;
class Modal extends Action implements HttpGetActionInterface
{
public const ADMIN_RESOURCE = 'Esun_LegacyOrder::orders';
public function __construct(
Action\Context $context,
private readonly LayoutFactory $layoutFactory
) {
parent::__construct($context);
}
public function execute()
{
$layout = $this->layoutFactory->create();
$html = $layout->createBlock(ViewBlock::class)
->setData('modal', true)
->toHtml();
return $this->resultFactory->create(ResultFactory::TYPE_RAW)
->setHeader('Content-Type', 'text/html; charset=UTF-8', true)
->setContents($html);
}
}