ReviewTab.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Review\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 ReviewTab
  13. *
  14. * @package Magento\Review\Block\Adminhtml
  15. */
  16. class ReviewTab 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. * @return \Magento\Framework\Phrase
  51. */
  52. public function getTabLabel()
  53. {
  54. return __('Product Reviews');
  55. }
  56. /**
  57. * Return URL link to Tab content
  58. *
  59. * @return string
  60. */
  61. public function getTabUrl()
  62. {
  63. return $this->getUrl('customer/*/productReviews', ['_current' => true]);
  64. }
  65. }