ExportDetails.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Refer to LICENSE.txt distributed with the Temando Shipping module for notice of license
  4. */
  5. namespace Temando\Shipping\Block\Adminhtml\Shipping\View;
  6. use Magento\Backend\Block\Template as BackendTemplate;
  7. use Magento\Backend\Block\Template\Context;
  8. use Temando\Shipping\Model\Shipment\ExportDeclarationInterface;
  9. use Temando\Shipping\Model\Shipment\ShipmentProviderInterface;
  10. use Temando\Shipping\Model\ShipmentInterface;
  11. /**
  12. * Temando Shipment Details Listing Layout Block
  13. *
  14. * @package Temando\Shipping\Block
  15. * @author Sebastian Ertner <sebastian.ertner@netresearch.de>
  16. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  17. * @link http://www.temando.com/
  18. *
  19. * @api
  20. */
  21. class ExportDetails extends BackendTemplate
  22. {
  23. /**
  24. * @var ShipmentProviderInterface
  25. */
  26. private $shipmentProvider;
  27. /**
  28. * @param Context $context
  29. * @param ShipmentProviderInterface $shipmentProvider
  30. * @param mixed[] $data
  31. */
  32. public function __construct(
  33. Context $context,
  34. ShipmentProviderInterface $shipmentProvider,
  35. array $data = []
  36. ) {
  37. $this->shipmentProvider = $shipmentProvider;
  38. parent::__construct($context, $data);
  39. }
  40. /**
  41. * @return ExportDeclarationInterface | null
  42. */
  43. public function getExportDeclaration()
  44. {
  45. /** @var ShipmentInterface $shipment */
  46. $shipment = $this->shipmentProvider->getShipment();
  47. return ($shipment ? $shipment->getExportDeclaration() : null);
  48. }
  49. }