help.api.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * @file
  4. * Hooks provided by the Help module.
  5. */
  6. /**
  7. * @addtogroup hooks
  8. * @{
  9. */
  10. /**
  11. * Provide online user help.
  12. *
  13. * By implementing hook_help(), a module can make documentation available to
  14. * the user for the module as a whole, or for specific paths. Help for
  15. * developers should usually be provided via function header comments in the
  16. * code, or in special API example files.
  17. *
  18. * For a detailed usage example, see page_example.module.
  19. *
  20. * @param $path
  21. * The router menu path, as defined in hook_menu(), for the help that is
  22. * being requested; e.g., 'admin/people' or 'user/register'. If the router
  23. * path includes a wildcard, then this will appear in $path as %, even if it
  24. * is a named %autoloader wildcard in the hook_menu() implementation; for
  25. * example, node pages would have $path equal to 'node/%' or 'node/%/view'.
  26. * To provide a help page for a whole module with a listing on admin/help,
  27. * your hook implementation should match a path with a special descriptor
  28. * after a "#" sign:
  29. * 'admin/help#modulename'
  30. * The main module help text, displayed on the admin/help/modulename
  31. * page and linked to from the admin/help page.
  32. * @param $arg
  33. * An array that corresponds to the return value of the arg() function, for
  34. * modules that want to provide help that is specific to certain values
  35. * of wildcards in $path. For example, you could provide help for the path
  36. * 'user/1' by looking for the path 'user/%' and $arg[1] == '1'. This given
  37. * array should always be used rather than directly invoking arg(), because
  38. * your hook implementation may be called for other purposes besides building
  39. * the current page's help. Note that depending on which module is invoking
  40. * hook_help, $arg may contain only empty strings. Regardless, $arg[0] to
  41. * $arg[11] will always be set.
  42. *
  43. * @return
  44. * A localized string containing the help text.
  45. */
  46. function hook_help($path, $arg) {
  47. switch ($path) {
  48. // Main module help for the block module
  49. case 'admin/help#block':
  50. return '<p>' . t('Blocks are boxes of content rendered into an area, or region, of a web page. The default theme Bartik, for example, implements the regions "Sidebar first", "Sidebar second", "Featured", "Content", "Header", "Footer", etc., and a block may appear in any one of these areas. The <a href="@blocks">blocks administration page</a> provides a drag-and-drop interface for assigning a block to a region, and for controlling the order of blocks within regions.', array('@blocks' => url('admin/structure/block'))) . '</p>';
  51. // Help for another path in the block module
  52. case 'admin/structure/block':
  53. return '<p>' . t('This page provides a drag-and-drop interface for assigning a block to a region, and for controlling the order of blocks within regions. Since not all themes implement the same regions, or display regions in the same way, blocks are positioned on a per-theme basis. Remember that your changes will not be saved until you click the <em>Save blocks</em> button at the bottom of the page.') . '</p>';
  54. }
  55. }
  56. /**
  57. * @} End of "addtogroup hooks".
  58. */