function theme_nice_menus in Nice Menus 7.2
Same name and namespace in other branches
- 6.2 nice_menus.module \theme_nice_menus()
- 7.3 nice_menus.module \theme_nice_menus()
Theme function to allow any menu tree to be themed as a Nice menu.
Parameters
array $variables: is an array, menu arguments.
Return value
mixed An HTML string of Nice menu links.
3 theme calls to theme_nice_menus()
- nice_menus_block_view in ./nice_menus.module 
- Implements hook_block_view().
- theme_nice_menus_main_menu in ./nice_menus.module 
- Theme the main menu as a Nice menu.
- theme_nice_menus_secondary_menu in ./nice_menus.module 
- Theme the secondary menu as a Nice menu.
File
- ./nice_menus.module, line 697 
- Module to enable CSS dropdown and flyout menus.
Code
function theme_nice_menus($variables) {
  $output = array(
    'content' => '',
    'subject' => '',
  );
  // The Nice menu ID.
  $id = $variables['id'];
  // The top parent menu name from which to build the full menu.
  $menu_name = $variables['menu_name'];
  // The menu ID from which to build the displayed menu.
  $mlid = $variables['mlid'];
  // Optional. The direction the menu expands. Default is 'right'.
  $direction = isset($variables['direction']) ? $variables['direction'] : 'right';
  // The number of children levels to display. Use -1 to display all children
  // and use 0 to display no children.
  $depth = isset($variables['depth']) ? $variables['depth'] : '-1';
  /*
   * Optional. A custom menu array to use for theming --
   * it should have the same structure as that returned
   * by menu_tree_all_data(). Default is the standard menu tree.
   */
  $menu = $variables['menu'];
  // "Show as expanded" option.
  $respect_expanded = isset($variables['respect_expanded']) ? $variables['respect_expanded'] : 0;
  if ($menu_tree = theme('nice_menus_tree', array(
    'menu_name' => $menu_name,
    'mlid' => $mlid,
    'depth' => $depth,
    'menu' => $menu,
    'respect_expanded' => $respect_expanded,
  ))) {
    if ($menu_tree['content']) {
      $output['content'] = '<ul class="nice-menu nice-menu-' . $direction . ' nice-menu-' . $menu_name . '" id="nice-menu-' . $id . '">' . $menu_tree['content'] . '</ul>' . "\n";
      $output['subject'] = $menu_tree['subject'];
    }
  }
  return $output;
}