[development] Splitting hook_menu into hook_menu and hook_router
Dries Buytaert
dries.buytaert at gmail.com
Thu Jan 18 12:37:56 UTC 2007
On 18 Jan 2007, at 11:38, Karoly Negyesi wrote:
>>> 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.
While I'm not opposed to the idea, I still fail to see the big win.
Just because it provides logical separation or do you have a better
reason? I guess a key reason is that the implementation drives both
features apart.
Still, I wonder why 5 people '+1'-ed the idea. I really like to
understand so hopefully these people will motivate their vote so
other can understand their reasoning/insights.
Often times both functions go hand in hand: you'd need to implement
one function to define the menu item, and one function to define the
router. They share or cooperate with regard to access control, plus,
sometimes you want to force both being connected -- i.e. you want the
menu/breadcrumb to adhere to the URL path or vice versa. Isn't the
trade-off that for 80% of the time, you need to learn two functions/
APIs instead of one to accomplish the same goal?
I still think it would be useful to take one or two examples and to
provide a 'before' and 'after'. Some practical examples will help us
grok the problem at hand.
> 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);
I like that because it is very intuitive. Although it is not clear
what the difference is between 'book page' (array key) and 'Book
page' (array title) or what happens when I have different 'book
page's at different positions in the menu tree? Certainly an
interesting idea though.
--
Dries Buytaert :: http://www.buytaert.net/
More information about the development
mailing list