Coverage index

src/Hook/HelpHooks.php

Lines: 100.00%

LineHitsSource
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Drupal\visitors\Hook;
6
7
use Drupal\Core\Hook\Attribute\Hook;
8
use Drupal\Core\StringTranslation\StringTranslationTrait;
9
10
/**
11
 * Implements hook_help().
12
 */
13
class HelpHooks {
14
  use StringTranslationTrait;
15
16
  /**
17
   * Implements hook_help().
18
   */
19
  #[Hook('help')]
20
  public function help($route_name, $route_match) {
21
    switch ($route_name) {
221
      case 'help.page.visitors':
23
        $help = '<p><a href="https://git.drupalcode.org/project/visitors/-/commits/3.0.x"><img alt="coverage report" src="https://git.drupalcode.org/project/visitors/badges/3.0.x/coverage.svg" /></a> &nbsp;';
24
        $help .= '<a href="https://git.drupalcode.org/project/visitors/-/commits/3.0.x"><img alt="pipeline status" src="https://git.drupalcode.org/project/visitors/badges/3.0.x/pipeline.svg" /></a> &nbsp;';
25
        $help .= '<a href="https://www.drupal.org/project/visitors">Homepage</a> &nbsp;';
261
        $help .= '<a href="https://www.drupal.org/project/issues/visitors?version=any_3.">Issues</a></p>';
271
        $help .= '<p>' . $this->t('The Visitors module logs all visitors to your site and provides various statistics about them.') . '</p>';
281
        $help .= '<h3>' . $this->t('How this filter works') . '</h3>';
291
        $help .= '<p>' . $this->t('The Current route Views filter keeps rows for the route of the page that displays the view.') . '</p>';
301
        $help .= '<ol>';
311
        $help .= '<li>' . $this->t('Take the path of the page where this view is displayed. The node Visitors tab is /node/1/visitors.') . '</li>';
321
        $help .= '<li>' . $this->t('Remove trailing parts. Removing 1 drops "visitors" and leaves /node/1.') . '</li>';
331
        $help .= '<li>' . $this->t('Add parts when you need a different page. "edit" changes /node/1 into /node/1/edit.') . '</li>';
341
        $help .= '<li>' . $this->t('Look up the route for the path that remains. /node/1 is entity.node.canonical. /node/1/edit is entity.node.edit_form.') . '</li>';
351
        $help .= '<li>' . $this->t('Keep rows whose route column equals that route name. A path that is not a route matches no rows.') . '</li>';
361
        $help .= '</ol>';
371
        return [
381
          '#title' => $this->t('Visitors'),
391
          'description' => [
401
            '#markup' => $help,
411
          ],
421
        ];
43
    }
44
  }
45
46
}