Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
7 / 7 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
VisitorsTimestamp | |
100.00% |
7 / 7 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
query | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
2 | |||
postExecute | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace Drupal\visitors\Plugin\views\sort; |
4 | |
5 | use Drupal\views\Plugin\views\sort\SortPluginBase; |
6 | use Drupal\visitors\Service\SequenceService; |
7 | |
8 | /** |
9 | * Sort handler for days of the week respecting system first day setting. |
10 | * |
11 | * @ViewsSort("visitors_timestamp") |
12 | */ |
13 | class VisitorsTimestamp extends SortPluginBase { |
14 | |
15 | /** |
16 | * {@inheritdoc} |
17 | */ |
18 | public function query() { |
19 | $this->ensureMyTable(); |
20 | $field = $this->field; |
21 | if ($field == 'visitor_localtime') { |
22 | $field = 'visitors_visitor_localtime'; |
23 | } |
24 | |
25 | /** @var \Drupal\views\Plugin\views\query\Sql $query */ |
26 | $query = $this->query; |
27 | $query->addOrderBy(NULL, NULL, $this->options['order'], $field); |
28 | } |
29 | |
30 | /** |
31 | * {@inheritdoc} |
32 | */ |
33 | public function postExecute(&$values) { |
34 | $values = SequenceService::fill($values); |
35 | } |
36 | |
37 | } |