function navbar_submenu($entry, $level = 1) { echo str_pad('', ($level - 1) * 2) . ' <li class="dropdown-submenu"><a href="' . $entry['url'] . '"><i class="menu-icon ' . $entry['icon'] . '"></i> ' . $entry['title'] . '</a>' . PHP_EOL; echo str_pad('', ($level - 1) * 2) . ' <ul class="dropdown-menu">' . PHP_EOL; foreach ($entry['entries'] as $subentry) { if (count($subentry['entries'])) { navbar_submenu($subentry, $level + 1); } else { navbar_entry($subentry, $level + 2); } } echo str_pad('', ($level - 1) * 2) . ' </ul>' . PHP_EOL; echo str_pad('', ($level - 1) * 2) . ' <li>' . PHP_EOL; }
function navbar_submenu($entry, $level = 1) { echo str_pad('', ($level - 1) * 2) . ' <li class="dropdown-submenu">' . generate_menu_link($entry['url'], '<i class="menu-icon ' . $entry['icon'] . '"></i> ' . $entry['title'], $entry['count']) . PHP_EOL; echo str_pad('', ($level - 1) * 2) . ' <ul role="menu" class="dropdown-menu">' . PHP_EOL; foreach ($entry['entries'] as $subentry) { if (count($subentry['entries'])) { navbar_submenu($subentry, $level + 1); } else { navbar_entry($subentry, $level + 2); } } echo str_pad('', ($level - 1) * 2) . ' </ul>' . PHP_EOL; echo str_pad('', ($level - 1) * 2) . ' <li>' . PHP_EOL; }