You are here

function theme_responsive_menu_tree in Responsive and off-canvas menu 7.2

Same name and namespace in other branches
  1. 7.3 theme/theme.inc \theme_responsive_menu_tree()
  2. 7 theme/theme.inc \theme_responsive_menu_tree()

Returns HTML for a wrapper for a menu sub-tree.

Parameters

$variables: An associative array containing:

  • tree: An HTML string containing the tree's items.

See also

template_preprocess_responsive_menu_tree()

File

theme/theme.inc, line 49

Code

function theme_responsive_menu_tree($variables) {
  $plid = $variables['plid'];
  if ($variables['depth'] > 1) {
    $content = '<ul class="sub-nav menu-tree-mlid-' . $plid . '">';
    $content .= $variables['tree']['#children'] . '</ul>';
    return $content;
  }
  else {

    // This is the top level of the tree. Add the necessary id so that
    // javascript can target this menu.
    if (isset($variables['tree']['#id'])) {
      $attributes = 'id="' . $variables['tree']['#id'] . '"';
    }
    else {
      $attributes = 'id="horizontal-menu" class="horizontal-menu"';
    }
    return '<ul ' . $attributes . '>' . $variables['tree']['#children'] . '</ul>';
  }
}