When adding a menu item in views I see three selections that are ambiguius

Normal menu entry

Menu tab

Default menu tab

What is the difference and when would I use each?

enter image description here


They correspond to the type parameter of items returned from hook_menu()

  • Normal menu entry = MENU_NORMAL_ITEM

    Menu type -- A "normal" menu item that's shown in menu and breadcrumbs.

    Normal menu items show up in the menu tree and can be moved/hidden by the administrator. Use this for most menu items. It is the default value if no menu item type is specified.

  • Menu tab = MENU_LOCAL_TASK

    Menu type -- A task specific to the parent item, usually rendered as a tab. Local tasks are menu items that describe actions to be performed on their parent item. An example is the path "node/52/edit", which performs the "edit" task on "node/52".

  • Default menu tab = MENU_DEFAULT_LOCAL_TASK

    Menu type -- The "default" local task, which is initially active.

    Every set of local tasks should provide one "default" task, that links to the same path as its parent when clicked.

The best example I can think of are node pages. When you visit a node page, the 'View' tab is provided by a menu item of type MENU_DEFAULT_LOCAL_TASK (see $items['node/%node/view'] in node_menu()).

It doesn't have a path as such (it inherits from the parent menu item), it's only purpose it to allow the node page to have a tab amongst the groups of 'real' tabs, which are defined with MENU_LOCAL_TASK.

  • Thanks @Clive. The last two are still ambiguous to me. Do you think you could add an example of each to define when I would use one over the other when creating the page for my view? – Nigel Waters Mar 1 '13 at 23:25
  • I've had a go, hope it makes sense :) – Clive Mar 2 '13 at 0:10
  • Sorry it's still not clicking for me. When would "I" use them when making a view? – Nigel Waters Mar 2 '13 at 0:17
  • 1
    Say you wanted to add a view that has a nid as a contextual filter, and you want to have a tab for it on node pages...you would set the path as node/%node/mypath and choose "Menu tab". The "Default menu tab" comes into it when you're setting the default for a group of tabs, as in the node page example. node/[nid]/view and node/[nid] resolve to the same page - the only purpose of the former is to make sure the tab is visible when you visit the latter. Any clearer? It's quite tricky to explain – Clive Mar 2 '13 at 0:37
  • Thanks for taking the time Clive. I appreciate it. I think I got it now. I'll give it some time to sink in. :) – Nigel Waters Mar 2 '13 at 2:20

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