Comments.php 1.5 KB

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