Lines: 0.00%
| Line | Hits | Source |
|---|---|---|
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Drupal\visitors\Plugin\views\argument; | |
| 6 | ||
| 7 | use Drupal\views\Attribute\ViewsArgument; | |
| 8 | use Drupal\views\Plugin\views\argument\StringArgument; | |
| 9 | ||
| 10 | /** | |
| 11 | * Filters a referrer keyword, including keywords that were not stored. | |
| 12 | * | |
| 13 | * The argument "not-defined" matches an empty or NULL keyword. That is the | |
| 14 | * label Matomo uses when a search engine sends no query. | |
| 15 | */ | |
| 16 | #[ViewsArgument('visitors_referer_keyword')] | |
| 17 | class RefererKeyword extends StringArgument { | |
| 18 | ||
| 19 | /** | |
| 20 | * {@inheritdoc} | |
| 21 | */ | |
| 22 | public function query($group_by = FALSE) { | |
| 23 | 0 | if ($this->argument === 'not-defined') { |
| 24 | 0 | $this->ensureMyTable(); |
| 25 | 0 | $field = "{$this->tableAlias}.{$this->realField}"; |
| 26 | 0 | $this->query->addWhereExpression( |
| 27 | 0 | 0, |
| 28 | 0 | "($field = '' OR $field IS NULL)" |
| 29 | 0 | ); |
| 30 | 0 | return; |
| 31 | } | |
| 32 | 0 | parent::query($group_by); |
| 33 | } | |
| 34 | ||
| 35 | } |