I have a node aliased to "trips".
I also have a menu item matching "trips/%".
The problem is that path_alias_xt_url_inbound_alter() doesn't check against wildcards when looking for an existing menu item, so "trips/foo" gets translated to "node/1234/foo" and the menu item callback never gets run.
The following patch extends the router check in _path_alias_xt_get_menu_item() to also check against wildcards that could match.
Before the patch:
/trip -- resolves to node/1234 correctly
/trip/manualalias -- works as an alias to any other url
/trip/xxxx -- menu item is not executed, instead resolves path to node/1234/xxxx
After the patch:
/trip -- resolves to node/1234 correctly
/trip/manualalias -- works as an alias to any other url
/trip/xxxx -- URL is left untouched, menu item is executed
| Comment | File | Size | Author |
|---|---|---|---|
| path_alias_xt.menu_wildcard.patch | 742 bytes | levialliance |
Comments
Comment #1
levialliance commentedNote that a side effect from this is that URLs that would normally be rewritten (eg /trips/edit => edit node/1234 that is aliased to /trips) won't be handled properly because they conflict with the menu item at the same URL (ie the wildcard menu item will handle /trips/edit rather than the node editing menu item)
In my case this behaviour is ok; but ultimately there's a conflict between two different menu items wanting to handle the same URL.
It would be theoretically possible to solve this if path_alias_xt_url_outbound_alter()/path_alias_xt_get_path_alias() also checked against wildcard menu items and left those particular items as node/1234/edit, but I can't see how this is possible without incurring a lot more overhead than the current system -- perhaps RdeBoer has some insight?
Comment #2
rdeboerThanks so much for your input and analysis levialliance,
Need some time to digest the pros and cons...
Rik
Comment #2.0
rdeboerFix patch/path typo
Comment #3
rdeboerBelieve this was fixed with 7.x-1.1.
Rik
Comment #5
semei commentedI still experience this issue (for me, problem) in the latest version 7.x-1.2.
Comment #6
semei commented