menu_block

Versions
4.6 – 6
menu_block($op = 'list', $delta = 0)

Implementation of hook_block().

Code

modules/menu/menu.module, line 269

<?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;
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.