I'm trying to create a view with tabs of different content. I've followed the instructions I found online in both video and text instructions but I am not seeing any tabs. I'm using the default Bartik theme if this matters. Is there some magic to this?

  1. I created a new view with 3 pages (paths portfolio/air, portfolio/earth, portfolio/fire)
  2. I created the different filters for each page and got all 3 to display the correct content.
  3. I added a menu setting to the air page, selected "Default menu tab" set the menu link title to "Air", then parent menu item "already exists".
  4. I added a menu to the earth and fire pages, selected "Menu tab" set the menu link title to "Earth" and "Fire", then the parent "Main Navigation" (for lack of a better choice).

No tabs anywhere.

I've played around with different things in the tab settings, all to no avail. Any help I could get would be much appreciated.

David Simmons

CommentFileSizeAuthor
#17 my_tabs.tar_.gz2.24 KBdrugan
#15 tabs.png33.09 KBnehapandya55

Comments

aarailfan created an issue. See original summary.

aarailfan’s picture

I was hoping to get some feedback on this. It's not clear to me if this works correctly with any release version of Drupal 8. Can anyone confirm if tabbed views works in D8 and if so, what the steps are to create them?

David Simmons

Zorkiy4’s picture

I have the same problem with Drupal 8.0.5.

I did all according to this manual: https://www.youtube.com/watch?v=EoSnUO9KB00

But tabs doesn't appear.

aarailfan’s picture

This appears to be fixed in Drupal 8.1.0.

tnfno’s picture

I am running 8.1.0, still not able to make it work properly.

If I make a view with multiple displays that has path /mypage/1 , /mypage/2 etc , I do get the tabs when I go to /mypage/1 . I have then NOT defined any default tab.

If I make a display with path /mypage and define that as default tab, going to /mypage only gives me this display and no tabs.

What I do not get is what to define as parent ? The default tab I make do not show up in the list. Why does the normal tab has parent option while the default tab does not?

What I want to do is to make a view that generates a normal menu entry and when I click on that menu item I get the view with tabs.

tnfno’s picture

I have now tested more and the following works if you want to create a new menu item and have a tabbed page :

  1. Create a view with a page display that has a normal menu item and path /mypath
  2. create a new display with default tab and 'already exists. Same pathe as above /mypath This will be your first and default tab
  3. creat additional displays with tab as menu and parent to to menu in 1) Path must be /mypath/tab1, /mypath/tabs etc
tnfno’s picture

Ok, this is weird. The above worked yesterday, even after drush cr and cron runs. This morning the tabs are gone and I do not get any tabs at /mypath, but /mypath/tab1 shows the tabs. Only thing I have done is to edit the fields in the view. Anyone that knows how this really works, I am lost and cannot find any proper instructions.

kfcp’s picture

Version: 8.0.5 » 8.2.0

Hello,

I am running version 8.2.0 and face the same problem: no tabs are visible although I have followed all the instructions.

Anyone an idea ?

Thanks

dansmith57’s picture

This will work using module_name.links.menu.yml

I was having the same issue and it seemed a little unstable, used the links.menu.yml file and it has been fine.

Example file contents:

mytab.tab_1:
  route_name : myroute.route1
  title: Tab Title 1
  base_route: myroute.route1
  weight: 10

mytab.tab_2:
  route_name: myroute.route2
  title: Tab Title 2
  base_route: myroute.route1
  weight: 20

I know this doesn't fix the way the author is saying it should work, just saying that using the yml file has been for me a reliable solution. I am not sure if themes can have a links.menu.yml - confirmation would be great. Thanks!

pengi’s picture

I have spent a great deal of time over the last few days trying to get drupal 8.2.1 view tabs to work with zero success. In drupal 7 they're easy. On various posts and videos there are 3-4 variations on how to configure so that drupal 8 view tabs work but none work for me.

I have never had exposure to a core issue before. Is this an issue that is likely to take a long time to get fixed and hopefully even documented re how to configure? Is there any way to encourage someone with the appropriate coding skills to have a crack at it?

sutharsan’s picture

I used the Drupal 8 version of the tutorial, and it worked: https://www.youtube.com/watch?v=hpuRdzyK3jI

Perhaps relevant is the order in which I created view and menu link. I first created both views and second I created a menu link that points to the 'default tab' view.

lendude’s picture

This feels like a duplicate of #2804195: Views does not create parent local task for a default local task, or are they just touching on the same subject?

wturrell’s picture

The following uses a single view to create two pages that each have a pair of tabs, Foo and Bar.

(this is using the stable release, 8.2.5)

  • /foo/ - tab Foo selected
  • /foo/bar - tab Bar selected

Instructions:

  1. Create a view called Foo, so it's path will be /foo, make it a page.
  2. Menu, choose "default menu tab", link text 'Foo', Apply, and for Parent Menu Item choose 'Already Exists'
  3. Displays, Add, Page
  4. Set the path of this one to /foo/bar
  5. Menu, choose "menu tab", menu link text 'Bar', Apply
  6. Save view
  7. Visit /foo and you should see both your tabs

Is that what everyone was trying to do?

Note your second page needs to have a path under/foo, if it's anything different, that's what'll stop the tabs appearing at all on the first page.
So that could be where people are going wrong.

If anyone knows what the correct technique is for /tabs/foo and /tabs/bar style URLs…

Possibly a case for improving the wording of the Parent menu thing, if we can think of something better?

nehapandya55’s picture

Thanks wturrell
I have tried to add tabs with many ways but nothing worked for me but #13 helped me to add tabs.

nehapandya55’s picture

StatusFileSize
new33.09 KB
lendude’s picture

Status: Active » Closed (works as designed)

@wturrell Thanks for the detailed steps to make this work. Closing, if there are still questions about how to do this, feel free to reopen.

drugan’s picture

StatusFileSize
new2.24 KB

If anyone knows what the correct technique is for /tabs/foo and /tabs/bar style URLs…

@wturrell

Did you mean displaying /tabs/foo, /tabs/bar, etc.., without /tabs default tab?

If so, there is an attempt:

  1. Rename my_tabs.tar_.gz file above to my_tabs.tar.gz and unpack it. You'll find two .yml configuration files inside, one is for the menu and another for the tabbed view.
  2. Go to /admin/config/development/configuration/single/import page, select Menu in the Configuration type select list and copy->paste content of the system.menu.hidden-menu.yml file. Click Import button.
  3. Repeat the #2 step for the View Configuration type and views.view.multitabs.yml file.
  4. Go to /tabsparent/tab1 or /tabsparent/tab2 to see your imported view with tabs.

Note that there is no /tabsparent default tab on the page, though obviously you can visit this page typing manually the path in address bar or clicking at the breadcrumbs' link if you have enabled those. For that case you have a specific views mode page with a redirect link to the page where actual Tabs could be found.

Just visit the /admin/structure/views/view/multitabbed_example page and set up what the content you want to see under the tabs and redirect page. For simplicity purposes I've added only content teasers for each tab and a simple redirect link on the /tabsparent page.

darkdante’s picture

I followed #17, this is working, but i would like to show tabs when opening /tabsparent as a url.

is it possible to show tab-view below a root url instead having a url like /tabsparent/tab1 to link to?

Thanks.

cvw’s picture

I had similar problems. Tabs appeared after I rebuilt caches. Maybe menu cache is not updated after modifying a menu link in Views?

raulito1500’s picture

Version: 8.2.0 » 8.3.6

After read a long history of posts related to this issue I find that my problem was that I hadn't created a menu item with the same url of the default tab. I mean, into my main menu i've created a menu item with "/foo". That's all.

Pd. Make sure of have a Tab Block enabled into your theme.

matt b’s picture

Version: 8.3.6 » 8.4.2
Category: Support request » Bug report
Status: Closed (works as designed) » Needs work

Sorry, this is a bug and needs work. The views tabs do not work out of the box. After trying so many different combinations of tabs, menu items, default tabs, etc, I finally got this working with:
1) Creating a menu item outside of the view
2) Creating a default menu tab with the same name as the menu item and setting the default tab to 'Already exists'
3) Setting the other pages as menu tabs
4) Rebuilding the Cache! (Thank you #19).

This is very frustrating as I have spent hours trying to get this working - it should be much more intuitive!

This is a bug because I should not have to rebuild the cache as a final step to get this working - it should work as soon as I save the view and refresh the page.

drugan’s picture

Status: Needs work » Active

"Needs work" is for patches being contributed and tested to detect the work needed. Unfortunately, there is no any patch yet.

Ether’s picture

Really disappointed with the way Drupal 8 was created. I started to use Drupal from version 6, and the version 8 feels like the entirely new system, with errors in the core in version 8.4.
Tabs functionality needs to be fixed, as none of the methods in this topic worked for me (fresh install on pantheon).

drugan’s picture

@Ether

I agree, Drupal 8 has a lot of vital issues ,,not-yet-fixed,, but you should not to complain. Just make a patch or even better a custom module and use it. You can even share it with us if you want.

That's all what we, regular drupalers, can do. Because lead Drupal developers are already achieved everything in their life and now playing with toys like umami-toy.

Ether’s picture

@drugan
Last paragraph does not sound good for the future of the Drupal. And good for things like Backdrop.
Unfortunately, I'm from those >95% who is using Drupal as LEGO. We are not programmers, but platform users. So, we cannot help you with core patching. Anyway, going back to ver. 7 with a hope that at ver. 7 EOL, Backdrop will be more mature.
Спасибо.

manuel.adan’s picture

liquidcms’s picture

Perhaps my case is slightly different, i have a custom page already defined and i am trying to add a local task (tab) off of this page using Views.

Originally i had a route as:

reserve.calendar:
  path: '/reserve/{ebundle}/calendar/{selected_month}/{selected_day}'
  defaults:
    _controller: '\Drupal\reserve\Controller\CalendarController::calendar'
    _title_callback: '\Drupal\reserve\Controller\CalendarController::calendarTitle'
    selected_month: ''
    selected_day: ''
  requirements:
    _permission: 'access content'

I added my view and set Tab as Menu Tab. I do not understand the new requirement in D8 to add Parent (which is busted UI as this isn't even available until after i save the Menu setting and then return to it). But as this parent makes no sense as this is menu items and should have nothing to do with this - I leave it as default Main Navigation. Why have we lost D7 concept of adding children tabs based on path? Big loss.

At this point i have no tabs showing.

After reading numerous posts it seems i need to add links entries:

I add these:

reserve.calendar:
  title: 'Calendar'
  route_name: reserve.calendar
  base_route: reserve.calendar

reserve.myreservation:
  title: 'My Reservations'
  route_name: view.reservations.page_2
  base_route: reserve.calendar
  route_parameters:
    arg_0: 'node.room'

Technically i don't think i should need the 2nd one (for the view); but added it anyway. Nice that the error msg tells me that i need to add arg_0 as a route parameter as any documentation/posts i found on this said it should be arg0.

This now gives me tabs when i go to my parent tab (the custom page which i have route entry for). And, the url for the 2nd tab (for my view) does go to the correct view page - BUT, when i am on that page, i do not have any tabs.

Pretty sure this is highlighting at least a couple core bugs (and certainly a lack of documentation).

[EDIT]
Hmm, after a bit more testing i found something even more odd. As you can see from my route above i can pass optional month/day parameters. These do work; but oddly I have found that 02/21 causes no tabs to show up. All other dates i have tested the tabs are displayed. Very strange.

liquidcms’s picture

Coming across a lot of bugs in 8.4 so thought i would upgrade to 8.6-dev to see if any of these issues have been fixed. The odd issue of missing tab on 02/21 is now gone and the tabs appear (as far as i have seen so far) on any variant of my page.

When i click the 2nd tab though i get wsod. Possibly this is due to the Views db update which failed. Will track it down.

liquidcms’s picture

in 8.4 i had my links.task defined for my View page (which i still don't think should be required as it is redundant info except to define parent; which should be auto defined by path as in D7 - but, to be fair, since switching to 8.6 i havent tried to remove the links.task entry for the view) - my route_parameter was defined as arg_0. Now, i changed it to the var name used in the route and set the path var in my view from % to %routevar. In other words, in route file i have {ebundle}, in links.task i have a route_parameter named ebundle and in my view i set path to reserve/%ebundle/my-reservations.

This fixes the wsod and, also, fixes that there was no tabs visible on my view page.

Perhaps some/all of this would be fixed in 8.4 if the variable names matched up like i have set here (sadly can't find any documentation on it though) - I will give it a try.

liquidcms’s picture

Works with 8.4.3 as long as variable names match everywhere.

[EDIT]

Changed with some sort of cache clear (not sure which; possibly with module re-enable). Now I no longer have route_parameters defined in links.tasks and still, in view, i have variable in path match that in routing file (%ebundle). Seems to all work.

Tonton2’s picture

#21 worked fine for me, thank you mate!

ShannonMcG’s picture

#21 Worked for me. But I got the WSOD error after saving the menu settings in the view. But I was able to go to a different /admin page and clear the caches. The tabs were working after that.

hughworm’s picture

frondeau’s picture

Good job @Matt b,
Those steps work for me.
Than you for your help.

yaach’s picture

Drupal 8.6.1, still does not work for me!

2dareis2do’s picture

thanks #13,

succinct and to the point.

ressa’s picture

Adding tabs in a Views page in Drupal 8.8.2 works fine, following the steps in #13, thanks for sharing @wturrell. I agree that the wording of "Already Exists" doesn't seem totally intuitive ...

rosiel’s picture

Worked in 8.8.4, following #20. Turns out you really do have to add an item in some Menu for /foo, then the tabs work. Otherwise, the paths work, but no tabs. Thanks @raulito1500

Version: 8.4.2 » 8.4.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

Version: 8.4.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Branches prior to 8.8.x are not supported, and Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

agerard’s picture

Please let me know if I should create a new issue... I've created 3 working views tabs, but am now struggling with how to get the "parent" menu link to remain active while toggling between tabs. Using a structure like this:
for view page1: /parent_page as the default (main menu link: parent_page)
for view page2: /parent_page/view2
for view page3: /parent_page/view3

When on the default tab, the main menu item parent_page is active, but clicking another tab turns off the active style for that link. I'd just like the parent_page link on the main menu to stay active when switching between tabs, so the user sees all the views as appearing to be under the parent_page navigation. I currently don't have corresponding submenu items under the main menu item "parent_page" - I tried adding them but it made no difference.

I'm definitely not a php wizard but can hack my way through simple modules and templates...Any suggestions would be greatly appreciated!

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.