comparison core/modules/statistics/statistics.views.inc @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children a9cd425dd02b
comparison
equal deleted inserted replaced
-1:000000000000 0:c75dbcec494b
1 <?php
2
3 /**
4 * @file
5 * Provide views data for statistics.module.
6 */
7
8 /**
9 * Implements hook_views_data().
10 */
11 function statistics_views_data() {
12 $data['node_counter']['table']['group'] = t('Content statistics');
13
14 $data['node_counter']['table']['join'] = [
15 'node_field_data' => [
16 'left_field' => 'nid',
17 'field' => 'nid',
18 ],
19 ];
20
21 $data['node_counter']['totalcount'] = [
22 'title' => t('Total views'),
23 'help' => t('The total number of times the node has been viewed.'),
24 'field' => [
25 'id' => 'statistics_numeric',
26 'click sortable' => TRUE,
27 ],
28 'filter' => [
29 'id' => 'numeric',
30 ],
31 'argument' => [
32 'id' => 'numeric',
33 ],
34 'sort' => [
35 'id' => 'standard',
36 ],
37 ];
38
39 $data['node_counter']['daycount'] = [
40 'title' => t('Views today'),
41 'help' => t('The total number of times the node has been viewed today.'),
42 'field' => [
43 'id' => 'statistics_numeric',
44 'click sortable' => TRUE,
45 ],
46 'filter' => [
47 'id' => 'numeric',
48 ],
49 'argument' => [
50 'id' => 'numeric',
51 ],
52 'sort' => [
53 'id' => 'standard',
54 ],
55 ];
56
57 $data['node_counter']['timestamp'] = [
58 'title' => t('Most recent view'),
59 'help' => t('The most recent time the node has been viewed.'),
60 'field' => [
61 'id' => 'node_counter_timestamp',
62 'click sortable' => TRUE,
63 ],
64 'filter' => [
65 'id' => 'date',
66 ],
67 'argument' => [
68 'id' => 'date',
69 ],
70 'sort' => [
71 'id' => 'standard',
72 ],
73 ];
74
75 return $data;
76 }