menu_block

Definition

menu_block($op = 'list', $delta = 0)
modules/menu/menu.module, line 268

Description

Implementation of hook_block().

Code

<?php
function menu_block($op = 'list', $delta = 0) {
  $menus = menu_get_menus();
  // The Navigation menu is handled by the user module.
  unset($menus['navigation']);
  if ($op == 'list') {
    $blocks = array();
    foreach ($menus as $name => $title) {
      // Default "Navigation" block is handled by user.module.
      $blocks[$name]['info'] = check_plain($title);
      // Menu blocks can't be cached because each menu item can have
      // a custom access callback. menu.inc manages its own caching.
      $blocks[$name]['cache'] = BLOCK_NO_CACHE;
    }
    return $blocks;
  }
  else if ($op == 'view') {
    $data['subject'] = check_plain($menus[$delta]);
    $data['content'] = menu_tree($delta);
    return $data;
  }
}
?>
 
 

Drupal is a registered trademark of Dries Buytaert.