Lines: 50.00%
| Line | Hits | Source |
|---|---|---|
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Drupal\visitors\Plugin\views\filter; | |
| 6 | ||
| 7 | use Drupal\Core\StringTranslation\TranslatableMarkup; | |
| 8 | use Drupal\views\Attribute\ViewsFilter; | |
| 9 | ||
| 10 | /** | |
| 11 | * Filters a path column by the current path. | |
| 12 | * | |
| 13 | * The value starts as the path of the page displaying the view. Site builders | |
| 14 | * can remove trailing parts or add parts. A page display can use this filter | |
| 15 | * because the value is not taken from a missing contextual argument. | |
| 16 | * | |
| 17 | * @ingroup views_filter_handlers | |
| 18 | */ | |
| 19 | #[ViewsFilter("visitors_current_path")] | |
| 20 | class CurrentPath extends CurrentPathFilterBase { | |
| 21 | ||
| 22 | /** | |
| 23 | * {@inheritdoc} | |
| 24 | */ | |
| 25 | public function query() { | |
| 26 | 3 | $this->applyValue($this->adjustedPath()); |
| 27 | } | |
| 28 | ||
| 29 | /** | |
| 30 | * {@inheritdoc} | |
| 31 | */ | |
| 32 | protected function summaryLabel(): TranslatableMarkup { | |
| 33 | 0 | return $this->t('Current path'); |
| 34 | } | |
| 35 | ||
| 36 | } |