1

I have built a DYNAMIC VIEW to display city data, broken out as tabs on the page -- it is a modified verion of the taxonomy term page view. It uses view menu tabs for this segregation, and Taxonomy Menu (of city names) to trigger the view.

screenshot of views tabbed page

The tabs all work correctly. The problem is the VIEW tab, which shows all results for the subject city (this is not a view display that I created). I don't want an "all results" tab, and I would like the Overview to be the active tab. However, it does not work to set the Overview as the default menu tab -- counterintuitive. (Have fiddled with this a lot! This year, and a project last year in D6.) All the desired tabs are set as "menu tabs". The paths are of this format: taxonomy/term/%/travel/guide/overview

scr_city-view-list

screenshot of views settings

The so-called menu parent path (default tab) doesn't really exist. It appears that the default taxonomy term page behavior creates the VIEW tab. Have the Taxonomy Term Page view enabled also with different path than my city view:

screenshot of views list - taxonomy term page

I can hide the VIEW tab with CSS, but then there is no active tab. Would like the Overview to be the active tab, hence first visual info.

NOTE: This issue is similar to this one (unresolved), but trickier because of taxonomy page behavior. Using Menu Tabs with Views 3 (Drupal 7)

Confirmed. I have a similar issue: the default tab always seems to use the parent menu item's path, instead of its own. I guess, what we'd really like, is that the parent menu item required by default tab item, exist only virtually but never be used on its own. Gonna file an issue for that. – Artur Apr 21 at 9:24

3

You need to understand that the default tab is not used for anything but the title and the weight of it. For an example, check node/%node/view in node_menu. Also check how node/%node is not a tab and yet when you are on example.com/node/1 you see the View because it's the default.

So. Since Drupal already provides a page on taxonomy/term/% all you need to add is a dummy Views display contents irrelevant, path should be taxonomy/term/%/does_not_matter_what with the title 'Overview' and a nice, negative weight and "default menu tab". All other displays are going to be "menu tabs" plain and these can get paths like taxonomy/term/%/travel.

You can play the same game with a Views display of your own instead of a Drupal provided page if you set that display as a page and the dummy as a children.

To summarize

  1. Have a page, a Views display or a Drupal page at foo/bar.
  2. Add a display at foo/bar/dummy with the title of the default tab and set it as type default tab.
  3. Now add any number of foo/bar/baz displays with the relevant titles as a normal tab.
0

So, if i understand correctly, you would like to replace the default local task "View" with your own default local task "Overview".

a few things to try:

  1. change the view page path for overview to taxonomy/term/%/view . If you can do this, it will override drupal core's menu router and use your view instead.

  2. implement hook_menu_alter to hide or remove taxonomy/term/%/view, and assign your own path taxonomy/term/%/travel/guide/overview as the default local task.

e.g.

function MYMODULE_menu_alter($items) {
  $items['taxonomy/term/%/view']['type'] = MENU_CALLBACK;
  $items['taxonomy/term/%/travel/guide/overview']['type'] = MENU_DEFAULT_LOCAL_TASK;
}

ymmv.

You may run into problems with this because Drupal really wants to find local tasks at the same depth as one another. ie. %/view, %/edit, %/devel instead of %/travel/guide/overview, %/travel/guide/etc. In the latter case, Drupal expects to find sets of actions at %/travel, and %/travel/guide, but it sounds like you want to collapse all 3 levels. You might want to consider refactoring your url paths to put all your menu items at the same level.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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