statistics.views.inc 1.5 KB

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