CustomerOrdersTab.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Sales\Block\Adminhtml;
  7. use Magento\Backend\Block\Template\Context;
  8. use Magento\Customer\Controller\RegistryConstants;
  9. use Magento\Framework\Registry;
  10. use Magento\Ui\Component\Layout\Tabs\TabWrapper;
  11. /**
  12. * Class CustomerOrdersTab
  13. *
  14. * @package Magento\Sales\Block\Adminhtml
  15. */
  16. class CustomerOrdersTab extends TabWrapper
  17. {
  18. /**
  19. * Core registry
  20. *
  21. * @var Registry
  22. */
  23. protected $coreRegistry = null;
  24. /**
  25. * @var bool
  26. */
  27. protected $isAjaxLoaded = true;
  28. /**
  29. * Constructor
  30. *
  31. * @param Context $context
  32. * @param Registry $registry
  33. * @param array $data
  34. */
  35. public function __construct(Context $context, Registry $registry, array $data = [])
  36. {
  37. $this->coreRegistry = $registry;
  38. parent::__construct($context, $data);
  39. }
  40. /**
  41. * @inheritdoc
  42. */
  43. public function canShowTab()
  44. {
  45. return $this->coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID);
  46. }
  47. /**
  48. * Return Tab label
  49. *
  50. * @codeCoverageIgnore
  51. *
  52. * @return \Magento\Framework\Phrase
  53. */
  54. public function getTabLabel()
  55. {
  56. return __('Orders');
  57. }
  58. /**
  59. * Return URL link to Tab content
  60. *
  61. * @return string
  62. */
  63. public function getTabUrl()
  64. {
  65. return $this->getUrl('customer/*/orders', ['_current' => true]);
  66. }
  67. }