1
0

BxBaseMenuSite.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 $_bApplicationMenu;
  16. protected $_aHideFromSiteMenuInPanel;
  17. public function __construct ($aObject, $oTemplate)
  18. {
  19. parent::__construct ($aObject, $oTemplate);
  20. $this->_bSiteMenuInPanel = $this->_sObject == 'sys_site_in_panel';
  21. $this->_bApplicationMenu = $this->_sObject == 'sys_application';
  22. $this->_aHideFromSiteMenuInPanel = ['more-auto'];
  23. }
  24. public function getCode ()
  25. {
  26. $sClass = 'bx-sliding-menu-main';
  27. $sStyle = 'display:none';
  28. if($this->_bSiteMenuInPanel || $this->_bApplicationMenu) {
  29. $sClass = 'bx-sliding-smenu-main';
  30. $sStyle = '';
  31. }
  32. 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">' . parent::getCode() . '</div></div>';
  33. }
  34. protected function _getMenuItem ($a)
  35. {
  36. //--- Hide '[More Auto]' from Site Menu in Panel
  37. if($this->_bSiteMenuInPanel && in_array($a['name'], $this->_aHideFromSiteMenuInPanel))
  38. return false;
  39. return parent::_getMenuItem ($a);
  40. }
  41. }
  42. /** @} */