The current API documentation for hook_help says hook_help is called with a $section parameter with a definite set of values, enumerated on the page.

However hook_help is also invoked with at least two other non documented values:

  • from the admin/help page, the hook is invoked with $section == 'admin/help'
  • from the admin/help/<modulename> page, the hook is invoked twice:
    • once with $section == 'admin/help#<modulename>' as documented
    • once with $section == 'admin/help/<modulename>' which is not documented

While the second invocation on admin/help/<modulename> seems redundant and one of the calls might have to be removed or at least documented as obsoleted, the ability for the hook to be fired from the main help page is valuable in that it allows a module creator to insert documentation in the main help page, so the doc should be amended to specify that behaviour.

Comments

drewish’s picture

Would you mind posting a patch that begins to correct this? Having one would make it easy to start a discussion.

fgm’s picture

It depends on what core developers think is the right fix to bring:

  1. should the path on on admin/help#<modulename> be removed or documented ?
  2. should the alternate path on admin/help/<modulename> be removed or documented ?
  3. should the path on admin/help be removed or documented ?

because this makes for a different patch in each case, either to code or to doc.

IMHO, (3) should be documented, (1) should be removed, and (2) should be kept and replace (1) in the docs because, as this is a page all on its own, it does not respect the usual "fragment" semantics, which are supposed to access a part of a page at the client side as the web server is not supposed to receive it. See for instance:

However, drupal apparently makes heavy use of the fragment parts or URLs (syntax (1)) so, for the sake of drupal's internal consistency, and at the cost of consistency with the rest of the WWW, it could be better to keep (1) instead of (2).

fgm’s picture

Project: Documentation » Drupal core
Version: » 4.7.0-beta1
Component: Developer Guide » base system

Actually, there are even more values being passed. It seems almost as if all modules are fired on each help-related URL, even when this does not apply to the module. For instance, hook_help is fired on admin/menu/item/edit/<mid> with the relative path as section.

At this point, it seems more a code issue than a documentation one.

Jaza’s picture

Version: 4.7.0-beta1 » 4.7.0
Component: base system » help.module
Status: Active » Closed (fixed)

There seems to be a general misunderstanding in this thread, about the use of the '#' symbol in help paths. In the help module, the '#' symbol is NOT used as a fragment identifier - it is used to separate the page path from any special descriptors that may be needed. This is clearly documented on the hook_help page.

The correct way for a module to have its help text appear on an admin/help/modulename page, is to use the admin/help#modulename value for its $section argument in hook_help. This may seem counter-intuitive, but it is the correct approach to let the help system recognise the special identifier (the module name, in this case), rather than putting the help text on the page directly.

Also, I don't see where hook_help is invoked with calls to admin/help/modulename or to admin/help in the help module.

fgm’s picture

Status: Closed (fixed) » Active

Jaza, it may indeed be a feature as you suggest.

However, you say "Also, I don't see where hook_help is invoked with calls to admin/help/modulename or to admin/help in the help module.", but I just retested with 4.7.0:

  • admin/help/modulename invokes:
    • admin/help#modulename
    • admin/help/modulename
    • admin/help#help/modulename
  • admin/help invokes hook_help with:
    • admin/help#modulename
    • admin/help
    • admin/help#help

so it seems the issue is still present.

magico’s picture

Version: 4.7.0 » x.y.z
Priority: Normal » Minor
ricabrantes’s picture

Version: x.y.z » 6.x-dev
Status: Active » Fixed

This bug are fixed in D6.x-dev..

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.