Problem/Motivation
In a view with tree pages and each one with its glossary attachment, the argument passed to the query by the glossary is added to the local tabs thus making local tabs useless
Steps to reproduce
Create a views page listing all nodes of some selection. don't enable Ajax because with ajax you can not see the real url on the browser (but google sees it anyway)
Settings:
- A -
- Path: 'my_page'; Menu: Type 'Default menu tab', Menu link title 'All'; Parent menu link 'Already exists'
- Contextual filter with content title, in More enable Glossary mode, Character limit to 1
- Create an attachment with Contextual filter 'content title',
- When the filter value is NOT available: Display a summary, Base path: 'my_page' (same as the menu), in More enable Glossary mode, Character limit to 1
- Attachment position: Before; Inherit contextual filters: No.
- Attach it to the page 'my page
- Enable Ajax in both page and attachment
- You now have they machine_names 'page_1' and 'attachment_1'
This is a setting to have a glossary and a sub-selection by starting letter.
- B -
Duplicate both page and attachment, they will be with machine_name 'page_1' and 'attachment_1'
Add an extra filter to the new page, change its path to 'my_page/selection1', set its Menu from 'Default menu tab' to 'Menu tab' and the Menu link title from 'All' to 'Selection1'. In contextual filters change Base path to 'my_page/selection_1'
Same with the new attachment. Change the new attachment to point to the new page
- C -
Duplicate "A" like in "B": change paths to 'my_page/selection_2', Menu link title from 'All' to 'Selection2', etc.
- D -
Display the page on path 'my_page'. You can see
three tabs ----- All ----- |------- Selection1 ------- | ----- Selection2 ---------
linked to "my_page" | "my_page_selection1 | "my_page/selection2"
On the browser address bar add a search argument to the url, let's say "my_page/selection1/k" (remember we use a glossary to select node titles by a starting letter)
Result: Inspect the tab urls,
they became "my_page/k" | "my_page/selection1/k" | "my_page/selection2/k"
So clicking the tabs you can no more access to "my_page" | "my_page/selection1" | "my_page/selection2"
which was the expected behavior.
Proposed resolution
I didn't dig into the code but I used hook_menu_local_tasks_alter to loop through tabs and reset url without the extra argument produced by the glossary.
$data['tabs'][$index][$tab_key]['#link']['url']->setRouteParameter('arg_0', NULL);
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet