Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Buttons.php
Go to the documentation of this file.
1 <?php
11 
13 
19 {
23  protected $_template = 'Magento_Sales::order/info/buttons.phtml';
24 
30  protected $_coreRegistry = null;
31 
35  protected $httpContext;
36 
43  public function __construct(
44  \Magento\Framework\View\Element\Template\Context $context,
45  \Magento\Framework\Registry $registry,
46  \Magento\Framework\App\Http\Context $httpContext,
47  array $data = []
48  ) {
49  $this->_coreRegistry = $registry;
50  $this->httpContext = $httpContext;
51  parent::__construct($context, $data);
52  $this->_isScopePrivate = true;
53  }
54 
60  public function getOrder()
61  {
62  return $this->_coreRegistry->registry('current_order');
63  }
64 
71  public function getPrintUrl($order)
72  {
73  if (!$this->httpContext->getValue(Context::CONTEXT_AUTH)) {
74  return $this->getUrl('sales/guest/print', ['order_id' => $order->getId()]);
75  }
76  return $this->getUrl('sales/order/print', ['order_id' => $order->getId()]);
77  }
78 
85  public function getReorderUrl($order)
86  {
87  if (!$this->httpContext->getValue(Context::CONTEXT_AUTH)) {
88  return $this->getUrl('sales/guest/reorder', ['order_id' => $order->getId()]);
89  }
90  return $this->getUrl('sales/order/reorder', ['order_id' => $order->getId()]);
91  }
92 }
$order
Definition: order.php:55
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\App\Http\Context $httpContext, array $data=[])
Definition: Buttons.php:43