Same name and namespace in other branches
  1. 4.6.x modules/menu.module \menu_block()
  2. 5.x modules/menu/menu.module \menu_block()
  3. 6.x modules/menu/menu.module \menu_block()

Implementation of hook_block().

File

modules/menu.module, line 113
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'] = check_plain($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;
    }
  }
}