Comments.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * Adminhtml sales shipment comment view block
  8. *
  9. * @author Magento Core Team <core@magentocommerce.com>
  10. */
  11. namespace Magento\Shipping\Block\Adminhtml\View;
  12. /**
  13. * @api
  14. * @since 100.0.2
  15. */
  16. class Comments extends \Magento\Backend\Block\Text\ListText
  17. {
  18. /**
  19. * Core registry
  20. *
  21. * @var \Magento\Framework\Registry
  22. */
  23. protected $_coreRegistry = null;
  24. /**
  25. * @param \Magento\Framework\View\Element\Context $context
  26. * @param \Magento\Framework\Registry $registry
  27. * @param array $data
  28. */
  29. public function __construct(
  30. \Magento\Framework\View\Element\Context $context,
  31. \Magento\Framework\Registry $registry,
  32. array $data = []
  33. ) {
  34. $this->_coreRegistry = $registry;
  35. parent::__construct($context, $data);
  36. }
  37. /**
  38. * Retrieve shipment model instance
  39. *
  40. * @return \Magento\Sales\Model\Order\Shipment
  41. */
  42. public function getShipment()
  43. {
  44. return $this->_coreRegistry->registry('current_shipment');
  45. }
  46. /**
  47. * Retrieve invoice order
  48. *
  49. * @return \Magento\Sales\Model\Order
  50. */
  51. public function getOrder()
  52. {
  53. return $this->getShipment()->getOrder();
  54. }
  55. /**
  56. * Retrieve source
  57. *
  58. * @return \Magento\Sales\Model\Order\Shipment
  59. */
  60. public function getSource()
  61. {
  62. return $this->getShipment();
  63. }
  64. }