Page displays have settings for creating menu items, found in the group page settings. The options no menu entry and normal menu entry are rather self-explanatory, but there are two more options that require some explanation.

Menu tab

The first of the more obscure options is menu tab. (See figure 10.9) Menu items of this kind will be visible as tabs on a given path, here called the tab's main page, rather than being displayed as normal menu items. Two requirements must be met to use menu tabs:

  • The path to the menu tab must be the same as the tab's main page, but one step deeper. If you want a tab to show up on example.com/main-page, the path to the menu tab could be example.com/main-page/my-tab.
  • There must be at least two (accessible) tabs on the main page. If there is only one tab present, it will be hidden by Drupal to avoid displaying tabs unnecessarily.


Figure 10.9: The menu option menu tab makes it easy to add new tabs to the pages on your website.

TIP: Menu tabs are efficient ways of extending existing pages on your Drupal site. A view with the path node/%/related could be added as a tab to all node pages with a few clicks.

TIP: It is likely that another option for menu links will become availble soon, local action. Menu items of this kind are similar to menu tabs in how they are set up, but are displayed as links at the top of pages, in the same way as the add new view link on the Views overview page.

Default menu tab

The second somewhat mysterious option is default menu tab. Creating default menu tabs is similar to creating regular menu tabs, but at the same time you are creating the main page for the tab. (This should only be used if there is not already a main page available.)

If the path to a page display is example.com/my-view/default-tab, a default menu tab will make the view accessible from both example.com/my-view/default-tab (the tab page) and example.com/my-view (the main page).

When configuring a default menu tab, you are also prompted to set which kind of menu item the main page should use.

Note: This section should be complemented with descriptions of the new fancy menu option "contextual link".

AttachmentSize
09.9 - menu tab.png45.15 KB

Comments

ruess’s picture

While a good overview, for those who really still don't get it (something I strugged it for a long time), there's a great resources which may help better give examples:

http://drupal.org/node/286376

http://success.grownupgeek.com/index.php/2010/07/25/how-add-tab-views

1mundus’s picture

One thing to add - there is a "Menu" setting for "Menu tab" option. You can safely ignore it - just leave it as it is and the tabs will show up.

nithinkolekar’s picture

To have two sub-tabs under a main tab (following http://www.tp1.ca/en/blog/views-and-drupal-7-creating-tabs-and-subtabs-2... and https://vimeo.com/55977889) how many total views displays are required?
Compared to above links in my view path is having contextual filter placeholder like
/assign-roll/%/year/%/class
/assign-roll/%/year/%/class/assigned -> default sub-tab
/assign-roll/%/year/%/class/pending -> additional sub-tab

But when visited link /assign-roll/2/year/1/class subtabs are showing? Is this cause of displays or paths?

Maung Maung’s picture

This tutorial from "Urban Insight" has more clear example with screenshots.

"Views Menu Tabs Quick Guide"
https://www.urbaninsight.com/node/239

mandclu’s picture

The content referenced in the previous comment has been moved to https://www.urbaninsight.com/article/views-menu-tabs-quick-guide

mrweiner’s picture

Drupal 8+ seems to need a slightly different configuration from D7, so following old tuts won't work. Take a look at this instead: https://drupal.stackexchange.com/questions/173306/how-to-create-views-ta...

  1. Create a page view and set its path to "/test" Then its menu option: Select "Default menu tab" and on next screen select "Already exist" under the "parent menu item".
  2. Then adds another page display set its path to "test/tab1" and in its menu option: select "Menu tab" and save.