Karoly Negyesi wrote:
Hi,
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.
+1 to all this. BTW: I still prefer hook_dispatch -- but that's because I've seen that term a lot in code I've worked with. Maybe it's just my history. =)