mirror of
https://github.com/bdnugget/magento2.git
synced 2026-11-08 01:37:36 +00:00
57 lines
1.5 KiB
PHP
57 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
*
|
|
* Copyright © Magento, Inc. All rights reserved.
|
|
* See COPYING.txt for license details.
|
|
*/
|
|
namespace Magento\Sales\Controller\AbstractController;
|
|
|
|
use Magento\Framework\App\Action\Context;
|
|
use Magento\Framework\View\Result\PageFactory;
|
|
|
|
abstract class PrintAction extends \Magento\Framework\App\Action\Action
|
|
{
|
|
/**
|
|
* @var \Magento\Sales\Controller\AbstractController\OrderLoaderInterface
|
|
*/
|
|
protected $orderLoader;
|
|
|
|
/**
|
|
* @var PageFactory
|
|
*/
|
|
protected $resultPageFactory;
|
|
|
|
/**
|
|
* @param Context $context
|
|
* @param OrderLoaderInterface $orderLoader
|
|
* @param PageFactory $resultPageFactory
|
|
*/
|
|
public function __construct(
|
|
Context $context,
|
|
OrderLoaderInterface $orderLoader,
|
|
PageFactory $resultPageFactory
|
|
) {
|
|
$this->orderLoader = $orderLoader;
|
|
$this->resultPageFactory = $resultPageFactory;
|
|
parent::__construct($context);
|
|
}
|
|
|
|
/**
|
|
* Print Order Action
|
|
*
|
|
* @return \Magento\Framework\Controller\ResultInterface
|
|
*/
|
|
public function execute()
|
|
{
|
|
$result = $this->orderLoader->load($this->_request);
|
|
if ($result instanceof \Magento\Framework\Controller\ResultInterface) {
|
|
return $result;
|
|
}
|
|
|
|
/** @var \Magento\Framework\View\Result\Page $resultPage */
|
|
$resultPage = $this->resultPageFactory->create();
|
|
$resultPage->addHandle('print');
|
|
return $resultPage;
|
|
}
|
|
}
|