[development] Splitting hook_menu into hook_menu and hook_router

Dries Buytaert dries.buytaert at gmail.com
Wed Jan 17 19:06:58 UTC 2007


> hook_router has these things:
>
> -- path as primary key. We use this as an array key, so an alter hook can
> easily be provided.
> -- access callback and arguments
> -- page callback and arguments
> -- map callback and arguments
>
> hook_menu has these:
>
> -- path. This is not unique. It's often requested that one path could have
> more than one visible link.
> -- parent. If you omit this, it can be autogenerated but for setting it to
> some arbitrary value, let's say MENU_ROOT can be used to indicate a new
> menu. With this (or via other means if someone has a better idea) we can
> put links into any menu.
> -- title.
> -- weight.
> -- expanded.

(I wrote a reply to this on my way home, ran out of battery and forgot
my power supply at work.  I'm using my wife's computer to reply. ;))

Can you elaborate some more on why this is good?   Do you have a
concrete use case with a before and after?  It would help me
understand ...

I agree that a logically seperation is a good thing, but this in
particular case, it seems as if there is some overlap.  For example,
both routers and menus would have to do access control ...

-- 
Dries Buytaert :: http://buytaert.net/


More information about the development mailing list