[development] Splitting hook_menu into hook_menu and hook_router

Karoly Negyesi karoly at negyesi.net
Thu Jan 18 10:38:44 UTC 2007


> > With path being unique in one and not unique in the other ...
> 
> Care to give a concrete example of where it goes wrong?  

It's not easy because currently you can not have this. But let's suppose you want to have an 'About' page in your navigation block and as a primary link to. You just can't do this currently as the current menu and the hook_router both are keyed on path. 

> logical separation.  While logical separation is a good thing, both a  
> menu and a router would have to do access control.  Looks like they  
> might be some overlap in functionality, if you split them?

Menu does not do access control at all, it turns to the router for that. The functionality is... very close to zero. Maybe around the title we have some.
 
> Btw, the 'page callaback' vs 'map callback' is going to be a source  
> of confusion.  

Sorry. Better names are welcome. But the 'map callback' is a very integral part now. It begun it's life as a convinience so that menu callbacks can act on objects instead of object ids but later on it became the main source of determining 404s for wildcarded paths. The documentation is also improved now, so it may be easier to understand. 'load callback' maybe?

I thought on what Adrian suggested, and here is what I was able to create: We use

$menu['navigation']['create content']['book page'] = array('title' => t('Book page'), 'weight' => 5);

to define visible link. This might or might not work. The arbitrary array keys might give us grief. There is no way we can have the actual title as keys, because of location -- or do we want $menu[t('Navigation')]... all the time? I think not. I will give it some more thought.


More information about the development mailing list