print.views.inc 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. // 'type' => 'INNER',
  26. );
  27. $data['print_page_counter']['table']['join']['node'] = array(
  28. // 'left_field' is the primary key in the referenced table.
  29. // 'field' is the foreign key in this table.
  30. 'left_field' => 'nid',
  31. 'field' => 'path',
  32. // 'type' => 'INNER',
  33. 'handler' => 'print_join_page_counter',
  34. );
  35. // print_node_conf fields
  36. $data['print_node_conf']['link'] = array(
  37. 'title' => t('Web: Show link'),
  38. 'help' => t('Whether to show the printer-friendly version link.'),
  39. 'field' => array(
  40. 'handler' => 'views_handler_field_boolean',
  41. 'click sortable' => TRUE,
  42. ),
  43. 'filter' => array(
  44. 'handler' => 'views_handler_filter_boolean_operator',
  45. 'label' => t('Active'),
  46. 'type' => 'yes-no',
  47. ),
  48. 'sort' => array(
  49. 'handler' => 'views_handler_sort',
  50. ),
  51. );
  52. $data['print_node_conf']['comments'] = array(
  53. 'title' => t('Web: Show link in individual comments'),
  54. 'help' => t('Whether to show the printer-friendly version link in individual comments.'),
  55. 'field' => array(
  56. 'handler' => 'views_handler_field_boolean',
  57. 'click sortable' => TRUE,
  58. ),
  59. 'filter' => array(
  60. 'handler' => 'views_handler_filter_boolean_operator',
  61. 'label' => t('Active'),
  62. 'type' => 'yes-no',
  63. ),
  64. 'sort' => array(
  65. 'handler' => 'views_handler_sort',
  66. ),
  67. );
  68. $data['print_node_conf']['url_list'] = array(
  69. 'title' => t('Web: Show Printer-friendly URLs list'),
  70. 'help' => t('Whether to show the URL list.'),
  71. 'field' => array(
  72. 'handler' => 'views_handler_field_boolean',
  73. 'click sortable' => TRUE,
  74. ),
  75. 'filter' => array(
  76. 'handler' => 'views_handler_filter_boolean_operator',
  77. 'label' => t('Active'),
  78. 'type' => 'yes-no',
  79. ),
  80. 'sort' => array(
  81. 'handler' => 'views_handler_sort',
  82. ),
  83. );
  84. // print_page_counter fields
  85. $data['print_page_counter']['totalcount'] = array(
  86. 'title' => t('Web: Number of page accesses'),
  87. 'help' => t('Counter of accesses to the printer-friendly version for this node.'),
  88. 'field' => array(
  89. 'handler' => 'views_handler_field_numeric',
  90. 'click sortable' => TRUE,
  91. ),
  92. 'sort' => array(
  93. 'handler' => 'views_handler_sort',
  94. ),
  95. 'filter' => array(
  96. 'handler' => 'views_handler_filter_numeric',
  97. ),
  98. );
  99. $data['print_page_counter']['timestamp'] = array(
  100. 'title' => t('Web: Last access'),
  101. 'help' => t("The date of the last access to the node's printer-friendly version."),
  102. 'field' => array(
  103. 'handler' => 'views_handler_field_date',
  104. 'click sortable' => TRUE,
  105. ),
  106. 'sort' => array(
  107. 'handler' => 'views_handler_sort_date',
  108. ),
  109. 'filter' => array(
  110. 'handler' => 'views_handler_filter_date',
  111. ),
  112. );
  113. return $data;
  114. }