/** * Render megamenu block * * @param string $position The position of the modules to render * @param array $params Associative array of values * @param string $content Module content * * @return string The output of the script * * @since 11.1 */ public function render($info = null, $params = array(), $content = null) { CANVAS::import('menu/canvasbootstrap'); // import the renderer $canvasapp = CANVAS::getApp(); $menutype = empty($params['menutype']) ? $canvasapp->getParam('mm_type', 'mainmenu') : $params['menutype']; JDispatcher::getInstance()->trigger('onCANVASBSMenu', array(&$menutype)); $menu = new CANVASBootstrap($menutype); return $menu->render(true); }
static function render($list) { $base = CANVASBootstrap::getBase(); $active = CANVASBootstrap::getActive(); $active_id = $active->id; $path = $base->tree; ?> <ul class="nav navbar-nav"> <?php foreach ($list as &$item) { $class = 'item-' . $item->id; if ($item->id == $active_id) { $class .= ' current'; } if (in_array($item->id, $path)) { $class .= ' active'; } elseif ($item->type == 'alias') { $aliasToId = $item->params->get('aliasoptions'); if (count($path) > 0 && $aliasToId == $path[count($path) - 1]) { $class .= ' active'; } elseif (in_array($aliasToId, $path)) { $class .= ' alias-parent-active'; } } if ($item->type == 'separator' || $item->type == 'heading') { $class .= ' divider'; } if ($item->deeper) { if ($item->level > 1) { $class .= ' dropdown-submenu'; } else { $class .= ' deeper dropdown'; } } if ($item->parent) { $class .= ' parent'; } if (!empty($class)) { $class = ' class="' . trim($class) . '"'; } echo '<li' . $class . '>'; // Render the menu item. switch ($item->type) { case 'separator': case 'url': case 'component': case 'heading': echo self::item($item->type, $item); break; default: echo self::item('url', $item); break; } // The next item is deeper. if ($item->deeper) { echo '<ul class="dropdown-menu" role="menu">'; } elseif ($item->shallower) { echo '</li>'; echo str_repeat('</ul></li>', $item->level_diff); } else { echo '</li>'; } } ?> </ul> <?php }