File: /var/www/vhost/disk-apps/magento.bikenow.co/vendor/magento/module-shipping/Block/Order/Shipment.php
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Shipping\Block\Order;
use Magento\Customer\Model\Context;
/**
* Sales order view block
*
* @api
* @since 100.0.2
*/
class Shipment extends \Magento\Framework\View\Element\Template
{
/**
* @var string
*/
protected $_template = 'Magento_Shipping::order/shipment.phtml';
/**
* Core registry
*
* @var \Magento\Framework\Registry
*/
protected $_coreRegistry = null;
/**
* @var \Magento\Framework\App\Http\Context
*/
protected $httpContext;
/**
* @var \Magento\Payment\Helper\Data
*/
protected $_paymentHelper;
/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\App\Http\Context $httpContext
* @param \Magento\Payment\Helper\Data $paymentHelper
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\App\Http\Context $httpContext,
\Magento\Payment\Helper\Data $paymentHelper,
array $data = []
) {
$this->_paymentHelper = $paymentHelper;
$this->_coreRegistry = $registry;
$this->httpContext = $httpContext;
parent::__construct($context, $data);
$this->_isScopePrivate = true;
}
/**
* @return void
*/
protected function _prepareLayout()
{
$this->pageConfig->getTitle()->set(__('Order # %1', $this->getOrder()->getRealOrderId()));
$infoBlock = $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment(), $this->getLayout());
$this->setChild('payment_info', $infoBlock);
}
/**
* @return string
*/
public function getPaymentInfoHtml()
{
return $this->getChildHtml('payment_info');
}
/**
* Retrieve current order model instance
*
* @return \Magento\Sales\Model\Order
*/
public function getOrder()
{
return $this->_coreRegistry->registry('current_order');
}
/**
* Return back url for logged in and guest users
*
* @return string
*/
public function getBackUrl()
{
if ($this->httpContext->getValue(Context::CONTEXT_AUTH)) {
return $this->getUrl('*/*/history');
}
return $this->getUrl('*/*/form');
}
/**
* Return back title for logged in and guest users
*
* @return \Magento\Framework\Phrase
*/
public function getBackTitle()
{
if ($this->httpContext->getValue(Context::CONTEXT_AUTH)) {
return __('Back to My Orders');
}
return __('View Another Order');
}
/**
* @param object $order
* @return string
*/
public function getInvoiceUrl($order)
{
return $this->getUrl('*/*/invoice', ['order_id' => $order->getId()]);
}
/**
* @param object $order
* @return string
*/
public function getViewUrl($order)
{
return $this->getUrl('*/*/view', ['order_id' => $order->getId()]);
}
/**
* @param object $order
* @return string
*/
public function getCreditmemoUrl($order)
{
return $this->getUrl('*/*/creditmemo', ['order_id' => $order->getId()]);
}
/**
* @param object $shipment
* @return string
*/
public function getPrintShipmentUrl($shipment)
{
return $this->getUrl('*/*/printShipment', ['shipment_id' => $shipment->getId()]);
}
/**
* @param object $order
* @return string
*/
public function getPrintAllShipmentsUrl($order)
{
return $this->getUrl('*/*/printShipment', ['order_id' => $order->getId()]);
}
}