TabWrapper.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Ui\Component\Layout\Tabs;
  7. use Magento\Framework\View\Element\Text\ListText;
  8. /**
  9. * Class TabWrapper
  10. */
  11. class TabWrapper extends ListText implements TabInterface
  12. {
  13. /**
  14. * @var bool
  15. */
  16. protected $canShowTab = true;
  17. /**
  18. * @var bool
  19. */
  20. protected $isHidden = false;
  21. /**
  22. * @var bool
  23. */
  24. protected $isAjaxLoaded = false;
  25. /**
  26. * Return Tab label
  27. *
  28. * @return string
  29. */
  30. public function getTabLabel()
  31. {
  32. return (string) $this->getData('tab_label');
  33. }
  34. /**
  35. * Return Tab title
  36. *
  37. * @return string
  38. */
  39. public function getTabTitle()
  40. {
  41. return (string) $this->getTabLabel();
  42. }
  43. /**
  44. * Tab class getter
  45. *
  46. * @return string
  47. */
  48. public function getTabClass()
  49. {
  50. return (string) $this->getData('tab_class');
  51. }
  52. /**
  53. * Return URL link to Tab content
  54. *
  55. * @return string
  56. */
  57. public function getTabUrl()
  58. {
  59. return (string) $this->getData('tab_url');
  60. }
  61. /**
  62. * Tab should be loaded trough Ajax call
  63. *
  64. * @return bool
  65. */
  66. public function isAjaxLoaded()
  67. {
  68. $flag = $this->getData('is_ajax_loaded');
  69. return $flag !== null ? (bool) $flag : $this->isAjaxLoaded;
  70. }
  71. /**
  72. * Can show tab in tabs
  73. *
  74. * @return boolean
  75. */
  76. public function canShowTab()
  77. {
  78. $flag = $this->getData('can_show_tab');
  79. return $flag !== null ? (bool) $flag : $this->canShowTab;
  80. }
  81. /**
  82. * Tab is hidden
  83. *
  84. * @return boolean
  85. */
  86. public function isHidden()
  87. {
  88. $flag = $this->getData('is_hidden');
  89. return $flag !== null ? (bool) $flag : $this->isHidden;
  90. }
  91. }