[development] Mapping aliases to menu items when having multiple aliases

Aaron Winborn winborn at advomatic.com
Thu Aug 13 13:29:15 UTC 2009

You might set up a View to a full node for the context.

Olivier Jacquet wrote:
> Yes, I've seen hook_menu_link_alter() and it is only called on saving 
> a menu link and the $item variable does not contain the path alias, 
> only the system path. So you can't even use it to link the inputted 
> path alias to the mlid.
> I'm unsure what it could be used for in my case...
> Earnie Boyd wrote, On 13/08/2009 14:50:
>> Quoting Olivier Jacquet <ojacquet at jax.be>:
>>> I'm looking for a way to create a module that allows you to map which
>>> url alias you want to associate with a specific menu entry when you
>>> have more than one alias associated with a system path. I've
>>> investigated this and cannot seem to find a way to implement it.
>>> The path module lets you create multiple url aliases for a node. The
>>> paths some-path and other-path can both be pointed to node/1. When
>>> someone creates a menu item and uses some-path to create it it's
>>> converted to node/1 and it is that path that is stored in the
>>> menu_links table.
>>> Then, in the case of the blocks generated by the menu module links are
>>> rendered through theme_menu_item_link() which calls l() which uses the
>>> first alias it finds and for the primary/secondary menu it's usualy
>>> theme('links', array()) which also results in a call to l(). In the
>>> former theme function you have access to the mlid but in the latter
>>> you haven't. This means there is no sane way to accomplish the
>>> functionality I want, I think.
>>> Does anyone have suggestions to accomplish this?
>>> The reason I want this is that I want to store context in the url
>>> alias, eg. context1/about and context2/about which point to the same
>>> node. This allows showing different blocks when navigating through a
>>> specific context. Maybe there is another way to achieve this?
>>> Note: I'm aware of duplicate content issues etc.
>> Have you seen http://api.drupal.org/api/function/hook_menu_link_alter?
>> -- 
>> Earnie
>> -- http://r-feed.com/ -- http://for-my-kids.com/
>> -- http://www.4offer.biz/ -- http://give-me-an-offer.com/

Aaron Winborn

Advomatic, LLC

Drupal Multimedia available in September!

My blog:

More information about the development mailing list