Consider the following observation
- You create a drupal menu and menu type is not declared i.e MENU_NORMAL_ITEM (drupal’s default menu type is MENU_NORMAL_ITEM) but you cannot see the menu link on under navigation menu.
- After clicking the menu link you see a error: warning: Invalid argument supplied for foreach() in C:\wamp\www\drupal6\includes\menu.inc on line 260
- Your callbacks aren’t firing
Common mistakes while creating Drupal Menu
- Have you set an access callback key to a function that is returning FALSE?
- Did you forget to add the line return $items; at the end of your menu hook?
- Did you accidentally make the value of access arguments or page arguments a string instead of an array?
- Have you cleared your menu cache and rebuilt the menu?
- If you’re trying to get menu items to show up as tabs by assigning the type as MENU_LOCAL_TASK, have you assigned a parent item that has a page callback?
- If you’re working with local tasks, do you have at least two tabs on a page (this is required for them to appear)?
Remember carefully
Any changes in hook_menu() function, please do not forget to rebuild your menu. You can do this by four (4) ways:
- From admin toolbar go to: Admin menu->Flash all cache->Menu
- Click rebuild menu item link under devel menu (if you installed devel module and assign development block on left sidebar)
- Clear your cache by visiting admin/settings/performence
- From Module list page (Administer->Site building->modules), disable the module and then enable again.
Finally An ideal way to declare menu
After successfully creating menu