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

CommentFileSizeAuthor
path_alias_xt.menu_wildcard.patch742 byteslevialliance

Comments

levialliance’s picture

Note 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?

rdeboer’s picture

Category: bug » feature

Thanks so much for your input and analysis levialliance,
Need some time to digest the pros and cons...
Rik

rdeboer’s picture

Issue summary: View changes

Fix patch/path typo

rdeboer’s picture

Assigned: Unassigned » rdeboer
Issue summary: View changes
Status: Active » Fixed

Believe this was fixed with 7.x-1.1.
Rik

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

semei’s picture

I still experience this issue (for me, problem) in the latest version 7.x-1.2.

semei’s picture

Version: 7.x-1.x-dev » 7.x-1.2
Status: Closed (fixed) » Active