/** * Overrides existing bs_navigation_topbar * @param SkinTemplate $sktemplate * @param BaseTemplate $tpl * @return boolean Always true to keep hook running */ public function onSkinTemplateOutputPageBeforeExec(&$sktemplate, &$tpl) { if (!isset($tpl->data['bs_navigation_sites'])) { return true; } $aNavigationSites = self::getNavigationSites(); if (empty($aNavigationSites)) { unset($tpl->data['bs_navigation_sites']); return true; } $bResult = wfRunHooks('BSTopMenuBarCustomizerBeforeRenderNavigationSites', array(&$aNavigationSites)); if ($bResult === false) { return true; } $aOut = array(); $aOut[] = HTML::openElement('ul'); foreach (self::getNavigationSites() as $aApp) { $aApp = array_merge(self::$aNavigationSiteTemplate, $aApp); $oMainItem = new ViewTopMenuItem(); $oMainItem->setLevel($aApp['level']); $oMainItem->setName($aApp['id']); $oMainItem->setLink($aApp['href']); $oMainItem->setDisplaytitle($aApp['text']); $oMainItem->setActive($aApp['active']); $oMainItem->setContainsActive($aApp['containsactive']); $oMainItem->setExternal($aApp['external']); if (!empty($aApp['children'])) { $oMainItem->setChildren($aApp['children']); } $aOut[] = $oMainItem->execute(); } $aOut[] = HTML::closeElement('ul'); $tpl->data['bs_navigation_sites'] = implode("\n", $aOut); return true; }
private function rederChildItems() { $aOut[] = '<ul class="bs-apps-child level-' . ($this->iLevel + 1) . '">'; foreach ($this->aChildren as $aApp) { $aApp = array_merge(TopMenuBarCustomizer::$aNavigationSiteTemplate, $aApp); $oItem = new ViewTopMenuItem(); $oItem->setLevel($aApp['level']); $oItem->setName($aApp['id']); $oItem->setLink($aApp['href']); $oItem->setActive($aApp['active']); $oItem->setExternal($aApp['external']); $oItem->setDisplaytitle($aApp['text']); $oItem->setContainsActive($aApp['containsactive']); if (!empty($aApp['children'])) { $oItem->setChildren($aApp['children']); } $aOut[] = $oItem->execute(); } $aOut[] = '</ul>'; return implode("\n", $aOut); }