print.views.inc 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?php
  2. /**
  3. * @file
  4. * Printer-friendly version Views integration.
  5. *
  6. * @ingroup print
  7. */
  8. /**
  9. * Implements hook_views_data().
  10. */
  11. function print_views_data() {
  12. // The 'group' index will be used as a prefix in the UI for any of this
  13. // table's fields, sort criteria, etc. so it's easy to tell where they came
  14. // from.
  15. $data['print_node_conf']['table']['group'] = t('Printer-friendly version');
  16. $data['print_page_counter']['table']['group'] = t('Printer-friendly version');
  17. // This table references the {node} table. The declaration below creates an
  18. // 'implicit' relationship to the node table, so that when 'node' is the base
  19. // table, the fields are automatically available.
  20. $data['print_node_conf']['table']['join']['node'] = array(
  21. // 'left_field' is the primary key in the referenced table.
  22. // 'field' is the foreign key in this table.
  23. 'left_field' => 'nid',
  24. 'field' => 'nid',
  25. );
  26. $data['print_page_counter']['table']['join']['node'] = array(
  27. // 'left_field' is the primary key in the referenced table.
  28. // 'field' is the foreign key in this table.
  29. 'left_field' => 'nid',
  30. 'field' => 'path',
  31. 'handler' => 'print_join_page_counter',
  32. );
  33. // print_node_conf fields.
  34. $data['print_node_conf']['link'] = array(
  35. 'title' => t('Web: Show link'),
  36. 'help' => t('Whether to show the printer-friendly version link.'),
  37. 'field' => array(
  38. 'handler' => 'views_handler_field_boolean',
  39. 'click sortable' => TRUE,
  40. ),
  41. 'filter' => array(
  42. 'handler' => 'views_handler_filter_boolean_operator',
  43. 'label' => t('Active'),
  44. 'type' => 'yes-no',
  45. ),
  46. 'sort' => array(
  47. 'handler' => 'views_handler_sort',
  48. ),
  49. );
  50. $data['print_node_conf']['comments'] = array(
  51. 'title' => t('Web: Show link in individual comments'),
  52. 'help' => t('Whether to show the printer-friendly version link in individual comments.'),
  53. 'field' => array(
  54. 'handler' => 'views_handler_field_boolean',
  55. 'click sortable' => TRUE,
  56. ),
  57. 'filter' => array(
  58. 'handler' => 'views_handler_filter_boolean_operator',
  59. 'label' => t('Active'),
  60. 'type' => 'yes-no',
  61. ),
  62. 'sort' => array(
  63. 'handler' => 'views_handler_sort',
  64. ),
  65. );
  66. $data['print_node_conf']['url_list'] = array(
  67. 'title' => t('Web: Show Printer-friendly URLs list'),
  68. 'help' => t('Whether to show the URL list.'),
  69. 'field' => array(
  70. 'handler' => 'views_handler_field_boolean',
  71. 'click sortable' => TRUE,
  72. ),
  73. 'filter' => array(
  74. 'handler' => 'views_handler_filter_boolean_operator',
  75. 'label' => t('Active'),
  76. 'type' => 'yes-no',
  77. ),
  78. 'sort' => array(
  79. 'handler' => 'views_handler_sort',
  80. ),
  81. );
  82. // print_page_counter fields.
  83. $data['print_page_counter']['totalcount'] = array(
  84. 'title' => t('Web: Number of page accesses'),
  85. 'help' => t('Counter of accesses to the printer-friendly version for this node.'),
  86. 'field' => array(
  87. 'handler' => 'views_handler_field_numeric',
  88. 'click sortable' => TRUE,
  89. ),
  90. 'sort' => array(
  91. 'handler' => 'views_handler_sort',
  92. ),
  93. 'filter' => array(
  94. 'handler' => 'views_handler_filter_numeric',
  95. ),
  96. );
  97. $data['print_page_counter']['timestamp'] = array(
  98. 'title' => t('Web: Last access'),
  99. 'help' => t("The date of the last access to the node's printer-friendly version."),
  100. 'field' => array(
  101. 'handler' => 'views_handler_field_date',
  102. 'click sortable' => TRUE,
  103. ),
  104. 'sort' => array(
  105. 'handler' => 'views_handler_sort_date',
  106. ),
  107. 'filter' => array(
  108. 'handler' => 'views_handler_filter_date',
  109. ),
  110. );
  111. return $data;
  112. }