View.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Customer\Block\Adminhtml\Edit\Tab;
  7. use Magento\Customer\Controller\RegistryConstants;
  8. use Magento\Ui\Component\Layout\Tabs\TabInterface;
  9. /**
  10. * Customer account form block
  11. */
  12. class View extends \Magento\Backend\Block\Template implements TabInterface
  13. {
  14. /**
  15. * Core registry
  16. *
  17. * @var \Magento\Framework\Registry
  18. */
  19. protected $_coreRegistry;
  20. /**
  21. * @param \Magento\Backend\Block\Template\Context $context
  22. * @param \Magento\Framework\Registry $registry
  23. * @param array $data
  24. */
  25. public function __construct(
  26. \Magento\Backend\Block\Template\Context $context,
  27. \Magento\Framework\Registry $registry,
  28. array $data = []
  29. ) {
  30. $this->_coreRegistry = $registry;
  31. parent::__construct($context, $data);
  32. }
  33. /**
  34. * @return string|null
  35. */
  36. public function getCustomerId()
  37. {
  38. return $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID);
  39. }
  40. /**
  41. * @return \Magento\Framework\Phrase
  42. */
  43. public function getTabLabel()
  44. {
  45. return __('Customer View');
  46. }
  47. /**
  48. * @return \Magento\Framework\Phrase
  49. */
  50. public function getTabTitle()
  51. {
  52. return __('Customer View');
  53. }
  54. /**
  55. * @return bool
  56. */
  57. public function canShowTab()
  58. {
  59. if ($this->getCustomerId()) {
  60. return true;
  61. }
  62. return false;
  63. }
  64. /**
  65. * @return bool
  66. */
  67. public function isHidden()
  68. {
  69. if ($this->getCustomerId()) {
  70. return false;
  71. }
  72. return true;
  73. }
  74. /**
  75. * Tab class getter
  76. *
  77. * @return string
  78. */
  79. public function getTabClass()
  80. {
  81. return '';
  82. }
  83. /**
  84. * Return URL link to Tab content
  85. *
  86. * @return string
  87. */
  88. public function getTabUrl()
  89. {
  90. return '';
  91. }
  92. /**
  93. * Tab should be loaded trough Ajax call
  94. *
  95. * @return bool
  96. */
  97. public function isAjaxLoaded()
  98. {
  99. return false;
  100. }
  101. }