Lines: 100.00%
| Line | Hits | Source |
|---|---|---|
| 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) { | |
| 22 | 1 | 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> '; | |
| 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> '; | |
| 25 | $help .= '<a href="https://www.drupal.org/project/visitors">Homepage</a> '; | |
| 26 | 1 | $help .= '<a href="https://www.drupal.org/project/issues/visitors?version=any_3.">Issues</a></p>'; |
| 27 | 1 | $help .= '<p>' . $this->t('The Visitors module logs all visitors to your site and provides various statistics about them.') . '</p>'; |
| 28 | 1 | $help .= '<h3>' . $this->t('How this filter works') . '</h3>'; |
| 29 | 1 | $help .= '<p>' . $this->t('The Current route Views filter keeps rows for the route of the page that displays the view.') . '</p>'; |
| 30 | 1 | $help .= '<ol>'; |
| 31 | 1 | $help .= '<li>' . $this->t('Take the path of the page where this view is displayed. The node Visitors tab is /node/1/visitors.') . '</li>'; |
| 32 | 1 | $help .= '<li>' . $this->t('Remove trailing parts. Removing 1 drops "visitors" and leaves /node/1.') . '</li>'; |
| 33 | 1 | $help .= '<li>' . $this->t('Add parts when you need a different page. "edit" changes /node/1 into /node/1/edit.') . '</li>'; |
| 34 | 1 | $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>'; |
| 35 | 1 | $help .= '<li>' . $this->t('Keep rows whose route column equals that route name. A path that is not a route matches no rows.') . '</li>'; |
| 36 | 1 | $help .= '</ol>'; |
| 37 | 1 | return [ |
| 38 | 1 | '#title' => $this->t('Visitors'), |
| 39 | 1 | 'description' => [ |
| 40 | 1 | '#markup' => $help, |
| 41 | 1 | ], |
| 42 | 1 | ]; |
| 43 | } | |
| 44 | } | |
| 45 | ||
| 46 | } |