You are here

function menutree_display in MenuTree 5

Same name and namespace in other branches
  1. 6 menutree.pages.inc \menutree_display()

Display a fully-expanded version of the menu specified on the path

Parameters

$pid: The menu to display. If none is specified, we default to the Primary Links menu.

$title_display: How to handle the display of the title. This is a bitmask that can take multiple values.

2 calls to menutree_display()
menutree_display_all in ./menutree.module
Menu callback; Display a fully-expanded version of all flagged menus.
menutree_display_page in ./menutree.module
Menu callback; Display a menu tree for a single specified menu.

File

./menutree.module, line 166
This module provides a simple "site map" tree based on the menu system rather than on taxonomies.

Code

function menutree_display($pid = 0, $title_display = MENUTREE_TITLE_PAGE) {
  $output = '';

  // Default to the Primary Links menu
  if (!$pid) {
    $pid = variable_get('menu_primary_menu', 0);
  }
  $menu = menu_get_item($pid);
  if (empty($menu)) {
    drupal_not_found();
  }
  $title = variable_get('menutree_title_' . $pid, $menu['title']);
  $title = check_plain($title);
  if ($title_display & MENUTREE_TITLE_PAGE) {
    drupal_set_title($title);
  }
  $tree_title = '';
  if ($title_display & MENUTREE_TITLE_BODY) {
    $tree_title = $title;
  }

  // Output custom intro text.
  $intro = variable_get('menutree_intro_text_' . $pid, '');
  $description = '';
  if (!empty($intro)) {
    $description = check_markup($intro, FILTER_FORMAT_DEFAULT, FALSE);
  }
  $tree = theme('menutree_tree', $pid);
  return theme('menutree_page', $tree_title, $description, $tree);
}