[development] Splitting hook_menu into hook_menu and hook_router

adrian rossouw adrian at bryght.com
Thu Jan 18 12:24:01 UTC 2007

On 17 Jan 2007, at 7:53 PM, Dries Buytaert wrote:

> Adrian, what do you mean with 'target path'?  Care to clarify?

Ok. there's 3 paths here.

1. the route path  .. the router array is indexed via this

   $items['node/%/%'] = array(
     'title' => t('View'),
     'page callback' => 'node_page_view',
     'page arguments' => array(1, 2),
     'access callback' => '_comment_view_access',
     'access arguments' => array(1, 2),
     'type' => MENU_CALLBACK,

2. the target path of the menu item. IE: the EXACT PAGE, the menu  
item is pointing to.

An example of this would be node/123.. When linking to node/123 using  
the menu item,
you would need to resolve the target path from node/123 to the route  
path 'node/%/%', to be able
to find out what the access permissions are. If this were the link  
hook, i would be referring to
the 'href' element. (unless you pass the $routes to the menu hook and  
make it an explicit argument)

3. the menu path. ie: where in the menu this item is located.
I think this is how i feel the menu data structure needs to be  
indexed, to be able to say where things are.

Either that or we don't index the menu items at all , making them  
incredibly difficult to manipulate. (ie: no menu_alter
hook where you could modify individual links).

Also, keep in mind, that in all likelihood, we will need to have the  
menu item only inherit from the route. It should probably
also be possible to override the access check for specific instances  
of that link.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20070118/a761db64/attachment.htm 

More information about the development mailing list