[development] Splitting hook_menu into hook_menu and hook_router
dopry at thing.net
Tue Jan 16 23:32:36 UTC 2007
On Tue, 2007-01-16 at 23:04 +0100, Karoly Negyesi wrote:
> We discussed renaming hook_menu and hook_router was a popular choice but
> as Gerhard says "I don't like to rename funtions just for the sake of
> renaming them" so it remained hook_menu .
> However, looking at my brain dump at http://drupal4hu.com/node/28 tells me
> that further down the road a split is needed.
> 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.
> With path being unique in one and not unique in the other, I fail to see
> how the two could be unified. And I fail to see the point as well. We
> could lose path being an array key and make it a property again in
> hook_router as it was in old hook_menu but then what shall happen if
> someone defines two router items to the same path? This is a mess. The
> above is nice and clean.
double plus good. We can remove silly locked menu items after this
split, no? What is the difference between page and map in hook_router?
More information about the development