• Avail guidance to develop Drupal modules & Drupal themes
  • Share and get review of your code
  • Get Access to free CodeBooks and ThemeBooks
  • Drupal 5, 6 and 7 covered

November 2009

Drupal hook: hook_menu

0
0

With Drupal, creating links which points to some content within the site or to some external content is quite easy using the in built interface for adding links. In Drupal, links are referred as menus, like in any desktop application. With Drupal interface for adding menus, we are just limited to add menus that points to some already existing content, like a node, or any external site. But when it comes to custom module, we have to add the menus by writing code. To add menus from the custom module, we need hook_menu function.

The hook_menu declares paths created and used by the module.
<?php
/**
* Implementation of hook_menu
*/
function hook_menu() {
$items = array();
$items['mypath'] = array(
'type' => MENU_NORMAL_MENU, // default is set to 'MENU_NORMAL_ITEM'

Syndicate content

Sitestats

Recent comments

rss-top-right.png
toolbar powered by www.iconcy.com