function hook_help

You are here

7 help.api.php hook_help($path, $arg)
4.6 core.php hook_help($section)
4.7 core.php hook_help($section)
5 core.php hook_help($section)
6 core.php hook_help($path, $arg)
8 help.api.php hook_help($path, $arg)

Provide online user help.

By implementing hook_help(), a module can make documentation available to the engine or to other modules. All user help should be returned using this hook; developer help should be provided with Doxygen/api.module comments.

Parameters

$section: Drupal URL path (or: menu item) the help is being requested for, e.g. admin/node or user/edit. Recognizes special descriptors after a "#" sign. Some examples:

  • admin/modules#name The name of a module (unused, but there)
  • admin/modules#description The description found on the admin/system/modules page.
  • admin/help#modulename The module's help text, displayed on the admin/help page and through the module's individual help link.
  • user/help#modulename The help for a distributed authorization module (if applicable).
  • node/add#nodetype The description of a node type (if applicable).

Return value

A localized string containing the help text. Every web link, l(), or url() must be replaced with %something and put into the final t() call: $output .= 'A role defines a group of users that have certain privileges as defined in %permission.'; $output = t($output, array('%permission' => l(t('user permissions'), 'admin/user/permission')));

For a detailed usage example, see page_example.module.

Related topics

44 functions implement hook_help()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

aggregator_help in modules/aggregator.module
Implementation of hook_help().
archive_help in modules/archive.module
Implementation of hook_help().
block_example_help in developer/examples/block_example.module
Implementation of hook_help().
block_help in modules/block.module
Implementation of hook_help().
blogapi_help in modules/blogapi.module
Implementation of hook_help().

... See full list

7 invocations of hook_help()
help_links_as_list in modules/help.module
help_menu in modules/help.module
Implementation of hook_menu().
help_page in modules/help.module
Menu callback; prints a page listing general help for all modules.
menu_get_active_help in includes/menu.inc
Returns the help associated with the active menu item.
node_add in modules/node.module
Present a node submission form or a set of links to such forms.

... See full list

File

developer/hooks/core.php, line 472
These are the hooks that are invoked by the Drupal core.

Code

function hook_help($section) {
  switch ($section) {
    case 'admin/help#block':
      return t('<p>Blocks are the boxes visible in the sidebar(s)
        of your web site. These are usually generated automatically by
        modules (e.g. recent forum topics), but you can also create your
        own blocks using either static HTML or dynamic PHP content.</p>');
      break;
    case 'admin/modules#description':
      return t('Controls the boxes that are displayed around the main content.');
      break;
  }
}