While I was studying hook_menu, I came across menu item types and I found that there are 6 types of menu item types as follows :







I have read the documentation on Drupal.og and doc says that we have different application of each menu item type.

But I am not able to differentiate when to use which menu item type? can I anyone help me to understand that which menu item type should be used ?

If any one explains use of each menu item type with example then it will be appreciated.


I realize this is a bit late, but just in case it helps anyone who stumbles across this...

1) MENU_CALLBACK - Menu callbacks are a special type of page that isn't meant to be viewed by a user. They are used as an endpoint for APIs (such as AJAX requests). Menu callbacks sort of act as a way for an API to "call a function".

2) MENU_DEFAULT_LOCAL_TASK - The default local task is just the local task that is selected by default. An example of this is the "view" tab on nodes. See more about local tasks below.

3) MENU_LOCAL_TASK - Local tasks are tabs. When viewing a node as an admin, several tabs are visible (view, edit, etc). Each of those tabs a local task.

4) MENU_NORMAL_ITEM - This is a page. Simple as that.

5) MENU_LOCAL_ACTION - Local actions are similar to local tasks, except they are meant to conduct an action, rather than display information. An example of this is the "Add Content" link that displays on the Content Administration page.

6) MENU_SUGGESTED_ITEM - This is almost exactly like a regular menu item, except it's disabled by default. This can be used by module makers to suggest a menu item to the user, but leave it up to the user to actually enable it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.