menu
Github

    public function menu()
    {
        return _class('html')->menu([
            11 => [
                'name' => 'Tools',
            ],
            22 => [
                'link' => url('/blocks'),
                'name' => 'Blocks editor',
                'parent_id' => 11,
            ],
            33 => [
                'link' => url('/file_manager'),
                'name' => 'File manager',
                'parent_id' => 11,
            ],
            44 => [
                'name' => 'Administration',
            ],
            55 => [
                'link' => url('/admin'),
                'name' => 'Admin accounts',
                'parent_id' => 44,
            ],
            66 => [
                'link' => url('/admin_groups'),
                'name' => 'Admin groups',
                'parent_id' => 44,
            ],
            77 => [
                'link' => url('/admin_modules'),
                'name' => 'Admin modules',
                'parent_id' => 44,
            ],
            88 => [
                'name' => 'Users',
                'parent_id' => 44,
            ],
            99 => [
                'link' => url('/manage_users'),
                'name' => 'User accounts',
                'parent_id' => 88,
            ],
            101 => [
                'link' => url('/user_groups'),
                'name' => 'User groups',
                'parent_id' => 88,
            ],
            102 => [
                'link' => url('/user_modules'),
                'name' => 'User modules',
                'parent_id' => 88,
            ],
            103 => [
                'name' => 'Content',
            ],
            104 => [
                'link' => url('/static_pages'),
                'name' => 'Static pages',
                'parent_id' => 103,
            ],
            105 => [
                'link' => url('/manage_news'),
                'name' => 'News',
                'parent_id' => 103,
            ],
            106 => [
                'link' => url('/manage_comments'),
                'name' => 'Comments',
                'parent_id' => 103,
            ],
        ]);
    }
    public function menu($data = [], $extra = [])
    {
        $extra['id'] = $extra['id'] ?: __FUNCTION__ . '_' . ++$this->_ids[__FUNCTION__];
        if ($data) {
            $data = $this->_recursive_sort_items($data);
        }
        $keys = array_keys($data);
        $keys_counter = array_flip($keys);
        $items = [];
        $ul_opened = false;
        foreach ((array) $data as $id => $item) {
            $next_item = $data[$keys[$keys_counter[$id] + 1]];
            $has_children = false;
            $close_li = 1;
            $close_ul = 0;
            if ($next_item) {
                if ($next_item['level'] > $item['level']) {
                    $has_children = true;
                }
                $close_li = $item['level'] - $next_item['level'] + 1;
                if ($close_li < 0) {
                    $close_li = 0;
                }
            }
            $badge = $item['badge'] ? ' <sup class="badge badge-' . ($item['class_badge'] ?: 'info') . '">' . $item['badge'] . '</sup>' : '';
            $items[] = '
				<li class="dropdown">
					<a href="' . $item['link'] . '" class="dropdown-toggle">' . $item['name'] . $badge . ($has_children ? ' <b class="caret"></b>' : '') . '</a>';
            if ($has_children) {
                $ul_opened = true;
                $items[] = PHP_EOL . '<ul class="dropdown-menu sub-menu">' . PHP_EOL;
            } elseif ($close_li) {
                if ($ul_opened && ! $has_children && $item['level'] != $next_item['level']) {
                    $ul_opened = false;
                    $close_ul = 1;
                }
                $tmp = str_repeat(PHP_EOL . ($close_ul ? '</li></ul>' : '</li>') . PHP_EOL, $close_li);
                if ($close_li > 1 && $close_ul) {
                    $tmp = substr($tmp, 0, -strlen('</ul>' . PHP_EOL)) . PHP_EOL;
                }
                $items[] = $tmp;
            }
        }
        return '<div class="navbar navbar-default' . ($extra['class'] ? ' ' . $extra['class'] : '') . '" id="' . $extra['id'] . '">
					<div class="navbar-inner navbar-header">
						<ul class="nav navbar-nav">' . implode(PHP_EOL, (array) $items) . '</ul>
					</div>
				</div>';
    }
Menu widget based on bootstrap navbar markup.

http://getbootstrap.com/components/#navbar