Test case:

  1. Create a node view with a contextual filter (provide default value, nid from url)
  2. Page view path: node/%/foobar
  3. Menu item entry: Default menu tab
  4. Parent setting: Already exists (would be node/[nid])

Problem: the tab gets created, but its path is node/[nid] and not node/[nid]/foobar

Weird workaround which might give some info:

  1. Path: node/%/foobar/blabla (add additional path part)
  2. Default tab options: Menu tab, title "blabla" (create a dummy parent)

Result: tab gets created, its path is node/[nid]/foobar (without blabla), tab title is "blabla"

I stumbled upon this problem when I tried to create a tab for og (on group nodes), but it is reproducible without og on a different drupal install.

Some infos about my drupal(s):
Drupal 7.20
Few modules activated, I can provide a full list, if you need it.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Ismail Cherri’s picture

Version: 7.x-3.5 » 7.x-3.7

Hi,
I confirm the same bug still occurring in views 7.x-3.7
and the suggested solution fixes the issue!

VangelisP’s picture

Version: 7.x-3.7 » 7.x-3.8
Issue summary: View changes

I confirm that this issue still exist in Views 3.8.

As indigoxela adviced, this workaround does work at the moment

indigoxela’s picture

Just for the records...

Problem with stripped path part still exists in views 7.x-3.13 (and workaround still works).

indigoxela’s picture

Version: 7.x-3.8 » 7.x-3.x-dev
FileSize
1.08 KB

File with problem: plugins/views_plugin_display_page.inc

Using array_pop() actually removes the array item, end() doesn't.

The last array item is needed to check for a possible parent and that the last part is no views placeholder (%), but the path itself should remain the same.

See attached patch file.

indigoxela’s picture

Oops, sorry, that was too fast...

Explanation: one time end() is correct and one time array_slice(), because for the parent-check the path minus one part is needed.
Anyway - array_pop is wrong in both cases.

Corrected patch is attached.

indigoxela’s picture

This is the final patch - I promise.

It turned out, only one array_pop war wrong.
So the change is minimal.

Please test and report.

indigoxela’s picture

Status: Active » Closed (works as designed)

Now I finally got the problem: my settings.

It's MENU_LOCAL_TASK (no stripping) vs. MENU_DEFAULT_LOCAL_TASK (strip the last part for the default item).

Menu item entry: Default menu tab is simply the wrong choice, the actual type would be Menu tab

Sorry for the fuzz.
(And, yes, tab handling in views 3 is somewhat confusing.)