[development] url as callback argument

Iñaki Lopez inaki.lopez at gmail.com
Wed Feb 4 06:09:05 UTC 2009


sorry, I don't know how did I realize the drupal version was six, and my
reply was a "finish-porting-this-to-d6"..
Now I see, only half of the menu entry is 'ported' as well..

Indeed, a very bad advice at all.. where the hell is my head?.. brbr

On Wed, Feb 4, 2009 at 12:32 AM, Jakob Petsovits <jpetso at gmx.at> wrote:

> On Tuesday 03 February 2009, Iñaki Lopez wrote:
> > $items[] = array(
> >    'path' => 'admin/settings/featured-comments/feature',
> >    'title' => t('featured comment'),
> >    'callback' => 'feature_comment',
> >    'callback_args' => $_GET['cid'],
> >
> > should be..
> >
> > $items[] = array(
> >    'path' => 'admin/settings/featured-comments/feature/%',
> >    'title' => t('featured comment'),
> >    'callback' => 'feature_comment',
> >    'callback_args' =>array(4),
> > ...
>
> Bad advice:
>
> 1. There is no '%' wildcard in Drupal 5, and Drupal 6 puts the path as
> array
> key instead of having a separate 'path' element.
>
> 2. There is no 'callback_args' property. array(...) is correct, but it also
> needs to be renamed to 'callback arguments' for Drupal to do anything with
> it.
> In Drupal 5, that would be "'callback arguments' => array($_GET['cid'])".
> (Or 'page callback' and 'page arguments' in Drupal 6, which I understand
> the
> original poster is not using at this time.)
>
> Maybe the thread is better off dead -
> http://api.drupal.org/api/function/hook_menu/5 has been posted already -
> but it's hard to leave the above example uncommented as is.
>
> Cheers,
>   j
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20090204/3dc48548/attachment-0001.htm 


More information about the development mailing list