| Versions | |
|---|---|
| 4.7 – 5 | hook_menu( |
| 6 – 7 | hook_menu() |
Define menu items and page callbacks.
This hook enables modules to register paths, which determines whose requests are to be handled. Depending on the type of registration requested by each path, a link is placed in the the navigation block and/or an item appears in the menu administration page (q=admin/menu).
This hook is called rarely - for example when modules are enabled.
http://drupal.org/node/102338 .
An array of menu items. Each menu item has a key corresponding to the Drupal path being registered. The item is an associative array that may contain the following key-value pairs:
If the "type" key is omitted, MENU_NORMAL_ITEM is assumed.
For a detailed usage example, see page_example.module.
For comprehensive documentation on the menu system, see
developer/
<?php
function hook_menu() {
$items = array();
$items['blog'] = array(
'title' => 'blogs',
'description' => 'Listing of blogs.',
'page callback' => 'blog_page',
'access arguments' => array('access content'),
'type' => MENU_SUGGESTED_ITEM,
);
$items['blog/feed'] = array(
'title' => 'RSS feed',
'page callback' => 'blog_feed',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
?>