You are here

function theme_responsive_navigation in Responsive Navigation 7

Theme function to allow any menu tree to be themed as a Responsive Navigation menu.

Parameters

array $variables: is an array, menu arguments.

Return value

mixed An HTML string of Responsive Navigation menu links.

3 theme calls to theme_responsive_navigation()
responsive_navigation_block_view in ./responsive_navigation.module
Implements hook_block_view().
theme_responsive_navigation_main_menu in ./responsive_navigation.module
Theme the main menu as a Responsive Navigation menu.
theme_responsive_navigation_secondary_menu in ./responsive_navigation.module
Theme the secondary menu as a Responsive Navigation menu.

File

./responsive_navigation.module, line 525

Code

function theme_responsive_navigation($variables) {
  $output = array(
    'content' => '',
    'subject' => '',
  );

  // The Responsive Navigation 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'];

  // The number of children levels to display. Use -1 to display all children
  // and use 0 to display no children.
  $depth = $variables['depth'];

  /*
   * 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 = $variables['respect_expanded'];
  if ($menu_tree = theme('responsive_navigation_tree', array(
    'menu_name' => $menu_name,
    'mlid' => $mlid,
    'depth' => $depth,
    'menu' => $menu,
    'respect_expanded' => $respect_expanded,
  ))) {
    if ($menu_tree['content']) {

      // Only one unique "#nav" div tag for now
      $output['content'] = '<div id="nav" class="responsive-navigation-menu-' . $id . ' navigation"><ul class="responsive-navigation responsive-navigation-' . $menu_name . '" id="responsive-navigation-menu-' . $id . '">' . $menu_tree['content'] . '</ul></div>' . "\n";
      $output['subject'] = $menu_tree['subject'];
    }
  }
  return $output;
}