You are here

function menu_block in Drupal 5

Same name and namespace in other branches
  1. 4 modules/menu.module \menu_block()
  2. 6 modules/menu/menu.module \menu_block()

Implementation of hook_block().

File

modules/menu/menu.module, line 115
Allows administrators to customize the site navigation menu.

Code

function menu_block($op = 'list', $delta = 0) {
  if ($op == 'list') {
    $blocks = array();
    $root_menus = menu_get_root_menus();
    foreach ($root_menus as $mid => $title) {

      // Default "Navigation" block is handled by user.module.
      if ($mid != 1) {
        $blocks[$mid]['info'] = $title;
      }
    }
    return $blocks;
  }
  else {
    if ($op == 'view') {
      $item = menu_get_item($delta);
      $data['subject'] = check_plain($item['title']);
      $data['content'] = theme('menu_tree', $delta);
      return $data;
    }
  }
}