/** * @desc Generate menu with custom ul ID and class * @author Allan Laal <*****@*****.**> * @param array $params * @return string */ public static function menu_80($params) { $data = array('items' => null, 'depth' => 1, 'active' => 'active', 'crumb' => 'crumb', 'disabled' => 'disabled', 'parent' => 'parent', 'children' => 'children', 'view' => 'Ip/Internal/Config/view/menu.php'); if (is_string($params)) { $params = array('items' => $params); } if (!empty($params[0]) && is_object($params[0]) && $params[0] instanceof \Ip\Menu\Item) { $params = array('items' => $params); } $data = array_merge($data, $params); // pass params to View along with other data if (isset($params['items']) && is_string($params['items'])) { $data['items'] = \Ip\Menu\Helper::getMenuItems($params['items']); } if (empty($data['attributes']) || !is_array($data['attributes'])) { $data['attributes'] = array(); } //generate attributes str if (empty($data['attributes']['class'])) { $data['attributes']['class'] = ''; } $data['attributes']['class'] = 'level' . $data['depth'] . ' ' . $data['attributes']['class']; $data['attributesStr'] = join(' ', array_map(function ($sKey) use($data) { if (is_bool($data['attributes'][$sKey])) { return $data['attributes'][$sKey] ? $sKey : ''; } return $sKey . '="' . $data['attributes'][$sKey] . '"'; }, array_keys($data['attributes']))); $view = ipView($data['view'], $data); return $view->render(); }
</div> </div> <div class="row"> <div class="small-12 column mobileMenuButton"><?php echo __('Menu', 'Glara'); ?> </div> <?php if (count(ipContent()->getLanguages()) > 1) { ?> <div class="small-12 column"> <nav class="languages"> <?php echo ipSlot('languages'); ?> </nav> </div> <?php } ?> <div class="small-12 column"> <nav class="main_nav"> <?php $items = \Ip\Menu\Helper::getMenuItems('menu1', 1, 2); echo ipSlot('menu', array('items' => $items, 'view' => ipThemeFile('view/menu.php'))); ?> </nav> </div> </div> </header> <div class="row content">