Shipments.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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\View\Tab;
  7. /**
  8. * Order Shipments grid
  9. *
  10. * @api
  11. * @since 100.0.2
  12. */
  13. class Shipments extends \Magento\Framework\View\Element\Text\ListText implements
  14. \Magento\Backend\Block\Widget\Tab\TabInterface
  15. {
  16. /**
  17. * Core registry
  18. *
  19. * @var \Magento\Framework\Registry
  20. */
  21. protected $_coreRegistry = null;
  22. /**
  23. * Collection factory
  24. *
  25. * @param \Magento\Framework\View\Element\Context $context
  26. * @param \Magento\Framework\Registry $coreRegistry
  27. * @param array $data
  28. */
  29. public function __construct(
  30. \Magento\Framework\View\Element\Context $context,
  31. \Magento\Framework\Registry $coreRegistry,
  32. array $data = []
  33. ) {
  34. $this->_coreRegistry = $coreRegistry;
  35. parent::__construct($context, $data);
  36. }
  37. /**
  38. * Retrieve order model instance
  39. *
  40. * @return \Magento\Sales\Model\Order
  41. */
  42. public function getOrder()
  43. {
  44. return $this->_coreRegistry->registry('current_order');
  45. }
  46. /**
  47. * {@inheritdoc}
  48. */
  49. public function getTabLabel()
  50. {
  51. return __('Shipments');
  52. }
  53. /**
  54. * {@inheritdoc}
  55. */
  56. public function getTabTitle()
  57. {
  58. return __('Order Shipments');
  59. }
  60. /**
  61. * {@inheritdoc}
  62. */
  63. public function canShowTab()
  64. {
  65. if ($this->getOrder()->getIsVirtual()) {
  66. return false;
  67. }
  68. return true;
  69. }
  70. /**
  71. * {@inheritdoc}
  72. */
  73. public function isHidden()
  74. {
  75. return false;
  76. }
  77. }