function custom_menu_tree($menus = array()) { $html = ''; // Build all application menus in a tree format foreach ($menus as $menu) { // Check if this menu has children $count_menu_children = count(get_value($menu, 'children')); // Build a single line menu $html .= '<li id="menu-item-' . get_value($menu, 'id_menu') . '" class="dd-item dd3-item" data-id="' . get_value($menu, 'id_menu') . '" order="' . get_value($menu, 'order_') . '">'; $html .= '<div class="dd-handle dd3-handle"></div>'; $html .= '<div class="dd3-content">'; $class = get_value($menu, 'dtt_inative') != '' ? 'text-error' : ''; $img = image(get_value($menu, 'url_img')); $label = get_value($menu, 'url_img') == '' && get_value($menu, 'label') == '' ? '[NO NAME]' : lang(get_value($menu, 'label')); $html .= '<a href="javascript:void(0)" class="menu-label ' . $class . '" data-toggle="modal" data-target="#modal-menu-' . get_value($menu, 'id_menu') . '">' . $img . ' ' . $label . '</a>'; $html .= '<i class="text-success fa fa-fw fa-check-circle" style="display: none; margin-left: 5px"></i>'; $html .= '<a href="javascript:void(0)" class="menu-delete pull-right hidden"><i class="fa fa-trash fa-fw"></i></a>'; $html .= '</div>'; // If current menu has children items, then build all again if ($count_menu_children > 0) { $html .= '<ol class="dd-list">' . custom_menu_tree(get_value($menu, 'children')) . '</ol>'; } $html .= '</li>'; } return $html; }
<div id="wrapper"> <div id="inside"> <div id="sidebar"> <div id="social-icons"><?php print render($page['socialicons']); ?> </div><!-- close div social-icons --> <div id="smoothmenu" class="mainmenu"> <?php if (isset($main_menu)) { ?> <?php print render(custom_menu_tree('main-menu')); ?> <?php /** print theme('links__system_main_menu', array( 'links' => $main_menu, 'attributes' => array( 'id' => 'main-menu-links', 'class' => array('links', 'clearfix'), ), 'heading' => array( 'text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible'), ), )); */ ?> <?php