How to build up a _help hook

Last modified: February 19, 2008 - 03:56

The following template can be used to build a _help hook.

<?php
function <modulename>_help($section){
 
$output = "";

  switch (
$section) {

  }
  return
$output;
}
?>

In the template replace modulename with the name of your module.

If you want to add help text to the overall administrative section. (admin/help) stick this inside the switch:

<?php
   
case 'admin/help#<modulename>':
     
$output = t('The text you want displayed');
      break;
?>

If you also want this same text displayed for an individual help link in your menu area. You have this kind of tree:

  + Administration
  |
  -> Your area
  |  |
  |  -> Your configuration
  |  -> help
  |
  -> Overall admin help.

Change the function line to this:

<?php
function <modulename>_help($section = 'admin/help#<modlename>') {
?>

Now that you have the template started place a case statement in for any URL you want a "context sesitive" help message in the admin section. An example, you have a page that individually configures your module, it is at admin/system/modules/, you want to add some text to the top help area.

<?php
   
case 'admin/system/modules/<modulename>':
     
$output = t('Your new help text');
      break;
?>

 
 

Drupal is a registered trademark of Dries Buytaert.