You are here

function statistics_help in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/statistics/statistics.module \statistics_help()
  2. 4 modules/statistics.module \statistics_help()
  3. 5 modules/statistics/statistics.module \statistics_help()
  4. 6 modules/statistics/statistics.module \statistics_help()
  5. 7 modules/statistics/statistics.module \statistics_help()

Implements hook_help().

File

core/modules/statistics/statistics.module, line 17
Logs and displays content statistics for a site.

Code

function statistics_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.statistics':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('The Statistics module shows you how often content is viewed. This is useful in determining which pages of your site are most popular. For more information, see the <a href=":statistics_do">online documentation for the Statistics module</a>.', [
        ':statistics_do' => 'https://www.drupal.org/documentation/modules/statistics/',
      ]) . '</p>';
      $output .= '<h3>' . t('Uses') . '</h3>';
      $output .= '<dl>';
      $output .= '<dt>' . t('Displaying popular content') . '</dt>';
      $output .= '<dd>' . t('The module includes a <em>Popular content</em> block that displays the most viewed pages today and for all time, and the last content viewed. To use the block, enable <em>Count content views</em> on the <a href=":statistics-settings">Statistics page</a>, and then you can enable and configure the block on the <a href=":blocks">Block layout page</a>.', [
        ':statistics-settings' => Url::fromRoute('statistics.settings')
          ->toString(),
        ':blocks' => \Drupal::moduleHandler()
          ->moduleExists('block') ? Url::fromRoute('block.admin_display')
          ->toString() : '#',
      ]) . '</dd>';
      $output .= '<dt>' . t('Page view counter') . '</dt>';
      $output .= '<dd>' . t('The Statistics module includes a counter for each page that increases whenever the page is viewed. To use the counter, enable <em>Count content views</em> on the <a href=":statistics-settings">Statistics page</a>, and set the necessary <a href=":permissions">permissions</a> (<em>View content hits</em>) so that the counter is visible to the users.', [
        ':statistics-settings' => Url::fromRoute('statistics.settings')
          ->toString(),
        ':permissions' => Url::fromRoute('user.admin_permissions', [], [
          'fragment' => 'module-statistics',
        ])
          ->toString(),
      ]) . '</dd>';
      $output .= '</dl>';
      return $output;
    case 'statistics.settings':
      return '<p>' . t('Settings for the statistical information that Drupal will keep about the site.') . '</p>';
  }
}