BxTemplMenuToolbar.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 UnaTemplate UNA Template Classes
  7. * @{
  8. */
  9. /**
  10. * @see BxDolMenu
  11. */
  12. class BxTemplMenuToolbar extends BxBaseMenuToolbar
  13. {
  14. protected $_bSiteToolbar;
  15. public function __construct ($aObject, $oTemplate = false)
  16. {
  17. parent::__construct ($aObject, $oTemplate);
  18. $this->_bSiteToolbar = $this->_sObject == 'sys_toolbar_site';
  19. }
  20. protected function _getMenuItem ($a)
  21. {
  22. //--- Hide 'Main Menu' and 'Search' from Site Toolbar
  23. if($this->_bSiteToolbar && in_array($a['name'], array('search')))
  24. return false;
  25. //--- Hide 'Login' from Member Toolbar
  26. if(!$this->_bSiteToolbar && in_array($a['name'], array('add-content')))
  27. return false;
  28. $a = BxTemplMenu::_getMenuItem ($a);
  29. if($a === false)
  30. return $a;
  31. $a['bx_if:unit'] = array(
  32. 'condition' => false,
  33. 'content' => array()
  34. );
  35. $a['class_add_a'] = '';
  36. switch ($a['name']) {
  37. case 'bx_lucid_search':
  38. $a['class_add'] = 'bx-def-media-phone-hide';
  39. break;
  40. case 'main-menu':
  41. $a['class_add_a'] = ' cd-dropdown-trigger';
  42. $a['link'] = 'javascript:void(0)';
  43. $a['onclick'] = '';
  44. break;
  45. }
  46. return $a;
  47. }
  48. protected function _getTmplVarsAddon($mixedAddon, $aMenuItem)
  49. {
  50. return array(
  51. 'addon' => $mixedAddon,
  52. 'addonf' => $this->_oTemplate->parseHtmlByTemplateName('menu_item_addon_small', array(
  53. 'content' => $mixedAddon
  54. ))
  55. );
  56. }
  57. }
  58. /** @} */