BxBaseMenuSite.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaBaseView UNA Base Representation Classes
  7. * @{
  8. */
  9. /**
  10. * Site main menu representation.
  11. */
  12. class BxBaseMenuSite extends BxTemplMenu
  13. {
  14. protected $_bSiteMenuInPanel;
  15. protected $_aHideFromSiteMenuInPanel;
  16. public function __construct ($aObject, $oTemplate)
  17. {
  18. parent::__construct ($aObject, $oTemplate);
  19. $this->_bSiteMenuInPanel = $this->_sObject == 'sys_site_in_panel';
  20. $this->_aHideFromSiteMenuInPanel = ['more-auto'];
  21. }
  22. public function getCode ()
  23. {
  24. $sClass = 'bx-sliding-menu-main';
  25. $sStyle = 'display:none';
  26. if($this->_bSiteMenuInPanel)
  27. $sStyle = '';
  28. $s = parent::getCode();
  29. return '<div id="bx-sliding-menu-' . $this->_sObject . '" class="' . $sClass . ' bx-def-z-index-nav bx-def-border-bottom" style="' . $sStyle . '"><div class="bx-sliding-menu-main-cnt">' . $s . '</div></div>';
  30. }
  31. protected function _getMenuItem ($a)
  32. {
  33. //--- Hide '[More Auto]' from Site Menu in Panel
  34. if($this->_bSiteMenuInPanel && in_array($a['name'], $this->_aHideFromSiteMenuInPanel))
  35. return false;
  36. return parent::_getMenuItem ($a);
  37. }
  38. }
  39. /** @} */