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

Arancaytar Ilyaran arancaytar.ilyaran at gmail.com
Fri Jun 15 23:27:13 UTC 2007


Peter Wolanin wrote:
> Gabor, node module is already returning help based on the values of arg():
> 
> http://drupal.org/node/125279
> 
> -Peter
> 

But that's not a good thing, right?

http://api.drupal.org/api/5/function/arg :
> Avoid use of this function where possible, as resulting code is hard to
> read. Instead, attempt to use named arguments in menu callback functions.

My experience with Drupal so far has been limited to the API, so I don't know
how things like this are handled in core. But I do know how much I used arg() in
my first attempts, and how much I would regret it when having to revisit that
code. It is faintly similar to the "Accumulate and Fire" antipattern. If the
help hook could be improved to the point where it doesn't need any workarounds
in core...

Also, here's one wild idea that I thought of when I read the other three:
Would it be at all sensible to pass the menu key ("node/%/edit") and a separate
array with all the variable values, in order: ($nid)?

--
Aran


More information about the development mailing list