In a custom module I have a hook_menu implementation with the following entries:
(adapted for better understanding. "xxx" was actually "mlid/%menu_link")
xxx : MENU_CALLBACK
xxx/under-construction : MENU_DEFAULT_LOCAL_TASK
xxx/add/page : MENU_LOCAL_TASK
xxx/add/%node_type : MENU_LOCAL_TASK
The intention:
- On xxx/under-construction, I want to see two tabs: The active one ("under construction") and the one for xxx/add/page.
- On xxx/add/page, I want to see two tabs: The active one ("add page") and "under construction".
- On xxx/add/webform, I want to see three tabs: xxx/under-construction, xxx/add/page, and xxx/add/webform.
For 1) and 3) this works as intended, just for 2) I see a duplicate tab for "xxx/add/page". Obviously, the first is created for the router item "xxx/add/page", and the second one is for "xxx/add/%node_type".
So, my thinking:
- Yes, I am using the system in a legitimate way. Router items with different argument masks are allowed to coexist.
- There is no point in having two tabs with the same link path. The more explicit router path (with fewer "%") should have priority, the other should be ignored.
Technical obervation:
The most important things happen in menu_local_tasks(), around this place:
<?php
while ($item = db_fetch_array($result)) {
_menu_translate($item, $map, TRUE);
if ($item['tab_parent']) {
?>
(my line numbers are probably incorrect due to some patching)
I have not tried this with D7, so I set the version to 6.x-dev. Feel free to change this, if you can confirm it for D7 !