hook_help function missing in .module file

Created on 7 February 2023, almost 2 years ago
Updated 26 March 2024, 9 months ago

Problem/Motivation

hook_help function missing in .module file

📌 Task
Status

RTBC

Version

2.0

Component

Code

Created by

🇮🇳India shubham rathore Jaipur

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @shubham rathore
  • @shubham-rathore-0 opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • 🇮🇳India shubham rathore Jaipur

    Hi create MR for this issue.
    Please review.
    Thanks

  • Assigned to Charchil Khandelwal
  • 🇮🇳India Charchil Khandelwal

    I will review this MR.

  • Issue was unassigned.
  • Status changed to RTBC almost 2 years ago
  • 🇮🇳India Charchil Khandelwal

    MR !12 looks good to me. So moving it to RTBC.

    Thanks.

  • 🇨🇦Canada joseph.olstad

    This is great, however where's the link to the config page?

    This is how the webform module does it:

    /**
     * Implements hook_help().
     */
    function webform_help($route_name, RouteMatchInterface $route_match) {
      if (!$route_match->getRouteObject()) {
        return NULL;
      }
    
      // Get path from route match.
      $path = preg_replace('/^' . preg_quote(base_path(), '/') . '/', '/', Url::fromRouteMatch($route_match)->setAbsolute(FALSE)->toString());
      if (!in_array($route_name, ['system.modules_list', 'update.status']) && strpos($route_name, 'webform') === FALSE && strpos($path, '/webform') === FALSE) {
        return NULL;
      }
    
      /** @var \Drupal\webform\WebformHelpManagerInterface $help_manager */
      $help_manager = \Drupal::service('webform.help_manager');
      if ($route_name === 'help.page.webform') {
        $build = $help_manager->buildIndex();
      }
      else {
        $build = $help_manager->buildHelp($route_name, $route_match);
      }
    
      if ($build) {
        $renderer = \Drupal::service('renderer');
        $config = \Drupal::config('webform.settings');
        $renderer->addCacheableDependency($build, $config);
        return $build;
      }
      else {
        return NULL;
      }
    }
    
    
Production build 0.71.5 2024