Problem/Motivation

Some of the information given by hook_help() is outdated. For example, it suggests installing a sub-module that no longer exists, it describes the regular expressions that were used from the Drupal 7 version (the MySQL regular expressions).

hook_help() should show minimal information. It should not describe details like the regular expressions to use, which should instead be described in a different page, like the Ban module does, for example.

  public function help($route_name, RouteMatchInterface $route_match): ?string {
    switch ($route_name) {
      case 'help.page.ban':
        $output = '';
        $output .= '<h2>' . $this->t('About') . '</h2>';
        $output .= '<p>' . $this->t('The Ban module allows administrators to ban visits to their site from individual IP addresses. For more information, see the <a href=":url">online documentation for the Ban module</a>.', [':url' => 'https://www.drupal.org/documentation/modules/ban']) . '</p>';
        $output .= '<h2>' . $this->t('Uses') . '</h2>';
        $output .= '<dl>';
        $output .= '<dt>' . $this->t('Banning IP addresses') . '</dt>';
        $output .= '<dd>' . $this->t('Administrators can enter IP addresses to ban on the <a href=":bans">IP address bans</a> page.', [':bans' => Url::fromRoute('ban.admin_page')->toString()]) . '</dd>';
        $output .= '</dl>';
        return $output;

      case 'ban.admin_page':
        return '<p>' . $this->t('IP addresses listed here are banned from your site. Banned addresses are completely forbidden from accessing the site and instead see a brief message explaining the situation.') . '</p>';
    }

Proposed resolution

Rewrite hook_help() to give a minimal information about the module.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

avpaderno created an issue. See original summary.

avpaderno’s picture

Title: Removed outdated or too detailed information given by hook_help() » Remove outdated or too detailed information given by hook_help()

avpaderno’s picture

Status: Active » Needs review

  • avpaderno committed b2d22c95 on 3.0.x
    Issue #3551721: Remove outdated or too detailed information given by...
avpaderno’s picture

Version: 3.0.x-dev » 2.0.x-dev
avpaderno’s picture

Version: 2.0.x-dev » 2.1.x-dev

  • avpaderno committed ccd7017d on 2.1.x
    Issue #3551721: Remove outdated or too detailed information given by...
avpaderno’s picture

Status: Needs review » Fixed

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.