2015-08-17 17:00:26 -07:00
< ? php
/**
* @ file
* Provide views data for statistics . module .
*/
/**
* Implements hook_views_data () .
*/
function statistics_views_data () {
2018-11-23 12:29:20 +00:00
$data [ 'node_counter' ][ 'table' ][ 'group' ] = t ( 'Content statistics' );
2015-08-17 17:00:26 -07:00
2017-04-13 15:53:35 +01:00
$data [ 'node_counter' ][ 'table' ][ 'join' ] = [
'node_field_data' => [
2015-08-17 17:00:26 -07:00
'left_field' => 'nid' ,
'field' => 'nid' ,
2017-04-13 15:53:35 +01:00
],
];
2015-08-17 17:00:26 -07:00
2017-04-13 15:53:35 +01:00
$data [ 'node_counter' ][ 'totalcount' ] = [
2015-08-17 17:00:26 -07:00
'title' => t ( 'Total views' ),
'help' => t ( 'The total number of times the node has been viewed.' ),
2017-04-13 15:53:35 +01:00
'field' => [
2016-06-15 16:49:40 -07:00
'id' => 'statistics_numeric' ,
2015-08-17 17:00:26 -07:00
'click sortable' => TRUE ,
2017-04-13 15:53:35 +01:00
],
'filter' => [
2015-08-17 17:00:26 -07:00
'id' => 'numeric' ,
2017-04-13 15:53:35 +01:00
],
'argument' => [
2015-08-17 17:00:26 -07:00
'id' => 'numeric' ,
2017-04-13 15:53:35 +01:00
],
'sort' => [
2015-08-17 17:00:26 -07:00
'id' => 'standard' ,
2017-04-13 15:53:35 +01:00
],
];
2015-08-17 17:00:26 -07:00
2017-04-13 15:53:35 +01:00
$data [ 'node_counter' ][ 'daycount' ] = [
2015-08-17 17:00:26 -07:00
'title' => t ( 'Views today' ),
'help' => t ( 'The total number of times the node has been viewed today.' ),
2017-04-13 15:53:35 +01:00
'field' => [
2016-06-15 16:49:40 -07:00
'id' => 'statistics_numeric' ,
2015-08-17 17:00:26 -07:00
'click sortable' => TRUE ,
2017-04-13 15:53:35 +01:00
],
'filter' => [
2015-08-17 17:00:26 -07:00
'id' => 'numeric' ,
2017-04-13 15:53:35 +01:00
],
'argument' => [
2015-08-17 17:00:26 -07:00
'id' => 'numeric' ,
2017-04-13 15:53:35 +01:00
],
'sort' => [
2015-08-17 17:00:26 -07:00
'id' => 'standard' ,
2017-04-13 15:53:35 +01:00
],
];
2015-08-17 17:00:26 -07:00
2017-04-13 15:53:35 +01:00
$data [ 'node_counter' ][ 'timestamp' ] = [
2015-08-17 17:00:26 -07:00
'title' => t ( 'Most recent view' ),
'help' => t ( 'The most recent time the node has been viewed.' ),
2017-04-13 15:53:35 +01:00
'field' => [
2016-06-15 16:49:40 -07:00
'id' => 'node_counter_timestamp' ,
2015-08-17 17:00:26 -07:00
'click sortable' => TRUE ,
2017-04-13 15:53:35 +01:00
],
'filter' => [
2015-08-17 17:00:26 -07:00
'id' => 'date' ,
2017-04-13 15:53:35 +01:00
],
'argument' => [
2015-08-17 17:00:26 -07:00
'id' => 'date' ,
2017-04-13 15:53:35 +01:00
],
'sort' => [
2015-08-17 17:00:26 -07:00
'id' => 'standard' ,
2017-04-13 15:53:35 +01:00
],
];
2015-08-17 17:00:26 -07:00
return $data ;
}