[development] hook_help() vs $section for Drupal 6

Gabor Hojtsy gabor at hojtsy.hu
Fri Jun 15 16:33:18 UTC 2007

Well, node paths were just an example, as these are what people are 
immediately familiar with. We can certainly do custom coding at all 
times, when we need details from the exact path of the page, not only 
the already processed menu path, but I am not sure most of the time we 
need that.

Now in Drupal 6:

  $_GET['q']                        | hook_help() $section parameter
node/1/view                        | node/%
node/1/edit                        | node/%/edit
user/1                             | user/%
admin/build/block/list/chameleon   | admin/build/block/list/chameleon
admin/build/block/configure/user/1 | admin/build/block/configure

The problem with the help hook parameter is that it is neither identical 
to what is defined in the menu hook, neither identical to the $_GET['q'] 
value, it is something different. Help hook authors need to resort to 
custom coding to get around these problems.


Peter Wolanin wrote:
> Gabor, node module is already returning help based on the values of arg():
> http://drupal.org/node/125279
> -Peter
> On 6/15/07, Gabor Hojtsy <gabor at hojtsy.hu> wrote:
>> It would be nice if some people would show interest in discussing this,
>> it is really a tiny question. Or should I pick and implement a solution
>> myself? Passing $_GET['q'] would be simplest obviously, but I am not
>> sure you would be fine with it. I only know for sure, if you tell us
>> your view.
>> Gabor
>> Gabor Hojtsy wrote:
>> > Hi,
>> >
>> > In an unrelated issue, we found that hook_help($section) gets called
>> > with the menu key now. So
>> >
>> >  - if you have a "node/%node/edit", you get this in the help hook
>> >  - if you have a "node", (which gets called with node/$nid too
>> >    obviously), you don't get the $nid in the help hook
>> >
>> > The argument for this is that it is easy to provide broad help texts.
>> > The arguments against is obviously that it is very hard to provide
>> > focused help texts (like it is impossible to provide help text for a
>> > block configuration page based on $section alone).
>> >
>> > A couple of ideas popped up from Peter Wolanin and myself, so we only
>> > need to pick up the right one :)
>> >
>> >  1. Pass on $_GET['q'] simply to hook_help(). This makes it harder
>> >     to provide a broad help text, as you would need to preg the
>> >     dynamic parts out yourself.
>> >
>> >  2. Pass on both $_GET['q'] and the menu key to hook_help(). This
>> >     would allow for both, if you wish. $section would become
>> >     $path and $menu_key or something along the lines.
>> >
>> >  3. Pass on the whole menu item structure which has even more
>> >     details. For people who would like to customize their help
>> >     even more (although I am not sure what else can be used from
>> >     the menu there).
>> >
>> > Now what is left is to pick one of these up, or suggest something
>> > better, so I can prepare a patch, and we can get this fixed soon.
>> >
>> > Gabor
>> >

More information about the development mailing list