Drupal investigation

statistics.views.inc 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. }