[support] 404 or alias for menu hook

Metzler, David metzlerd at evergreen.edu
Mon Jan 28 21:04:48 UTC 2008



-----Original Message-----
From: support-bounces at drupal.org [mailto:support-bounces at drupal.org] On
Behalf Of Ivan Sergio Borgonovo
Sent: Monday, January 28, 2008 12:46 PM
To: support at drupal.org
Subject: Re: [support] 404 or alias for menu hook


Avoiding duplication avoid duplicating correcting the code... so
parent with callback and default with no call back make sense.

But "this is directly because of the behavior that you indicated you
were trying to avoid :)" still does not.
---------------------------
Understood.... goodnight :)

For tomorrow : 

Not until drupal 6 do menu callbacks get inherited.  The menu is being
routed to the right function in milkshake/list because milkshake/list is
on the path for milkshake.   If you put in milkshake/foo it should get
processed by the same entry as milkshake, and if you registered your own
function instead of drupal_get_form, say call it
my_module_milkshake_overview() then that fuction would be called with a
single parameter. 

Consider the following in hook_menu

$items[] = array('path' => 'milkshake/list',
                 'callback' => 'mymodule_milkshake_list'); 

If you were to implement the function: 

function mymodule_milkshake_list($type='')
{
  // if the $type is specified then only list that type of milkshake.
}

Now if you browse to milkshake/list/chocolate the function
mymodule_milkshake will be called with $type containing a value of
"chocolate".  It is for this reason that the parents menu callback is
always called when deciding what function to call. 

Glad I could help....

Dave

 



More information about the support mailing list