[development] Splitting hook_menu into hook_menu and hook_router
karoly at negyesi.net
Fri Jan 19 02:38:13 UTC 2007
> > But sometimes, something might simply logically go in two places,
> > because classification isn't always as clean as we want it. This is
> > why we have two views for the administration page now. By Task and
> > By Module.
> Sure, but how would the router/menu separation simplify that compared
> to the current system. As far as I can tell, you'd still need two
> routers and two menu items.
You indeed need two router items for the 'by task' and the 'by module' pages.
However, what Merlin says is that these two pages prove that sometimes two links eventually pointing to the same place are meaningful and needed. The current administration menu is a mirror of the 'by task' page and there is no way to have an 'administration by module' menu because one page, one visible menu link is the current possibility. This is not merely a minor shortcoming of the old menu or even the new menu patch, both of which use path as a primary key -- router items naturally have path as primary key as you just can't have two router items for the same path and this needs to be enforced. As a side effect, we gain the possibility of an easy and trivial hook_menu_alter.
More information about the development