Drupal 7 View tabs

Creating tabs for a view is rather convoluted - you can’t just add a new page display and set it menu to ‘Menu tab’. You need to first create a default tab, but even that is not obvious.

Lets say that you have a view with a page display that lists all articles. The page is called ‘Master’ and is at path /articles. You’d like to add a tab to this, at /links/unpublished, that shows unpublished articles.

In order to do this you’ll need to create a default tab, at /articles/all, because the /articles/unpublished tab won’t show up unless we have another tab with the same path structure i.e. /articles/something.

You’ll need to do the following:

First, create another page display and give it path /articles/all. You could call it ‘Articles’ but it doesn’t really matter. Give this a ‘Default tab’ menu with title ‘Articles’, selecting ‘Already exists’ as its parent when asked.

This view is the same as the existing ‘Master’ display in all other respects. It will show the same as /articles, but we need it because we need a default tab that has the /articles/something path structure.

Next, create another page display that filters out published articles. Call it ‘Unpublished articles’, with path /foobar/unpublished and give it a ‘Menu tab’ menu with title ‘Unpublished articles’.

You should now have your tabs - an ‘Articles’ tab and an ‘Unpublished articles’ tab.

Last modified: 30/03/2016 Tags: ,

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top