You are here

function hooks_example_help in Examples for Developers 3.x

Same name and namespace in other branches
  1. 8 hooks_example/hooks_example.module \hooks_example_help()

Implements hook_help().

When implementing a hook you should use the standard text "Implements HOOK_NAME." as the docblock for the function. This is an indicator that further documentation for the function parameters can be found in the docblock for hook being implemented and reduces duplication.

This function is an implementation of hook_help(). Following the naming convention for hooks, the "hook_" in hook_help() has been replaced with the short name of our module, "hooks_example_" resulting in a final function name of hooks_example_help().

Related topics

File

modules/hooks_example/hooks_example.module, line 74
Examples demonstrating how to implement and invoke hooks.

Code

function hooks_example_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {

    // For help overview pages we use the route help.page.$moduleName.
    case 'help.page.hooks_example':
      return '<p>' . t('This text is provided by the function <code>hooks_example_help()</code>, which is an implementation of <code>hook hook_help()</code>. To learn more about how this works checkout the code in <code>hooks_example.module</code>.') . '</p>';
  }
}