0

I'm moving a site from Drupal 7 to Drupal 9/10.

In Drupal 7, there's a view with multiple page displays, set up like this:

Tab name Menu setting Path
All No menu events/list
Summer Default menu tab , Parent Already exists events/list/summer
Summer - Classes menu tab events/list/summer/classes
Summer - Picnics menu tab events/list/summer/picnics
Summer - Workshops menu tab events/list/summer/workshops
Autumn row events/list/autumn

All displays with a Menu Tab setting have Main Menu as the selected menu.

When you go to site.com/summer/list, you see two rows/sets of tabs:

[ Summer  ]    [ Autumn ]
[ Classes ]    [ Picnics ]    [ Workshops ]

The 3 Summer options appear as a separate set of tabs on a second line, and they're only visible when Summer is selected. When Autumn is selected, that second row of tabs is hidden.

Drupal gives secondary tab classes to the 3 Summer options ("tabs-secondary tabs secondary").

This is the desired result. We DO want the child items to be secondary tabs.

I've tried replicating this in Drupal 9, and the child tabs always show up as primary tabs, on the same level (as siblings) of the primary tabs (Summer and Autumn).

This happens whether I set events/list as the default tab or events/list/summer.

As far as I can tell, the only setting that makes Drupal 7 output the child tabs (classes, picnics, workshops) as secondary - which is what we want - is the path entry, and the fact that those paths all start with the parent path (events/list/summer).

I've seen https://www.drupal.org/project/drupal/issues/2693069#comment-11868944 and https://www.drupal.org/project/drupal/issues/2804195#comment-15232779

but none of the solutions I've found there have worked. I've tried using events/list as the default menu tab, but then my tabs all disappear.

Is there any way to get the child tabs to be output as secondary tabs instead of primary?

If I can't do this directly within Views, are there other modules or approaches or workarounds that would let me do this?

Thank you!

P.S. Just to confirm: in most places in Drupal 9/10 where you enter a path (e.g. Page entries for blocks, path aliases on nodes), you DO use a slash at the start of a path: /author/shakespeare, where you would have skipped the starting slash in D7: author/shakespeare. I have NOT been using a starting slash in my path settings in views. Aside from this tab issue, paths are working correctly on all my views. If for some reason I'm supposed to be using starting slashes in the Path field in Views, please let me know.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.