CartTab.php 1.5 KB

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