Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PrintShipment.php
Go to the documentation of this file.
1 <?php
7 
9 
17 {
23  protected $_coreRegistry = null;
24 
28  protected $_paymentHelper;
29 
33  protected $addressRenderer;
34 
42  public function __construct(
43  \Magento\Framework\View\Element\Template\Context $context,
44  \Magento\Framework\Registry $registry,
45  \Magento\Payment\Helper\Data $paymentHelper,
47  array $data = []
48  ) {
49  $this->_paymentHelper = $paymentHelper;
50  $this->_coreRegistry = $registry;
51  $this->addressRenderer = $addressRenderer;
52  parent::__construct($context, $data);
53  }
54 
58  protected function _prepareLayout()
59  {
60  $this->pageConfig->getTitle()->set(__('Print Order # %1', $this->getOrder()->getRealOrderId()));
61  $infoBlock = $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment(), $this->getLayout());
62  $this->setChild('payment_info', $infoBlock);
63  }
64 
68  public function getPaymentInfoHtml()
69  {
70  return $this->getChildHtml('payment_info');
71  }
72 
76  public function getOrder()
77  {
78  return $this->_coreRegistry->registry('current_order');
79  }
80 
87  public function isPagerDisplayed()
88  {
89  return false;
90  }
91 
98  public function getItems()
99  {
100  if (!$this->getOrder()) {
101  return [];
102  }
103  return $this->getOrder()->getItemsCollection()->getItems();
104  }
105 
110  protected function _prepareItem(AbstractBlock $renderer)
111  {
112  $renderer->setPrintStatus(true);
113  return parent::_prepareItem($renderer);
114  }
115 
122  public function getFormattedAddress(\Magento\Sales\Model\Order\Address $address)
123  {
124  return $this->addressRenderer->format($address, 'html');
125  }
126 }
__()
Definition: __.php:13
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Registry $registry, \Magento\Payment\Helper\Data $paymentHelper, \Magento\Sales\Model\Order\Address\Renderer $addressRenderer, array $data=[])
$address
Definition: customer.php:38
_prepareItem(AbstractBlock $renderer)
getFormattedAddress(\Magento\Sales\Model\Order\Address $address)