forum.views.inc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <?php
  2. /**
  3. * @file
  4. * Provide views data for forum.module.
  5. */
  6. /**
  7. * Implements hook_views_data().
  8. */
  9. function forum_views_data() {
  10. $data['forum_index']['table']['group'] = t('Forum');
  11. $data['forum_index']['table']['base'] = [
  12. 'field' => 'nid',
  13. 'title' => t('Forum content'),
  14. 'access query tag' => 'node_access',
  15. ];
  16. $data['forum_index']['nid'] = [
  17. 'title' => t('Nid'),
  18. 'help' => t('The content ID of the forum index entry.'),
  19. 'field' => [
  20. 'id' => 'numeric',
  21. ],
  22. 'filter' => [
  23. 'id' => 'numeric',
  24. ],
  25. 'argument' => [
  26. 'id' => 'numeric',
  27. ],
  28. 'sort' => [
  29. 'id' => 'standard',
  30. ],
  31. 'relationship' => [
  32. 'base' => 'node',
  33. 'base field' => 'nid',
  34. 'label' => t('Node'),
  35. ],
  36. ];
  37. $data['forum_index']['title'] = [
  38. 'title' => t('Title'),
  39. 'help' => t('The content title.'),
  40. 'field' => [
  41. 'id' => 'standard',
  42. 'link_to_node default' => TRUE,
  43. ],
  44. 'sort' => [
  45. 'id' => 'standard',
  46. ],
  47. 'filter' => [
  48. 'id' => 'string',
  49. ],
  50. 'argument' => [
  51. 'id' => 'string',
  52. ],
  53. ];
  54. $data['forum_index']['tid'] = [
  55. 'title' => t('Has taxonomy term ID'),
  56. 'help' => t('Display content if it has the selected taxonomy terms.'),
  57. 'argument' => [
  58. 'id' => 'taxonomy_index_tid',
  59. 'name table' => 'taxonomy_term_data',
  60. 'name field' => 'name',
  61. 'empty field name' => t('Uncategorized'),
  62. 'numeric' => TRUE,
  63. 'skip base' => 'taxonomy_term_data',
  64. ],
  65. 'field' => [
  66. 'id' => 'numeric',
  67. ],
  68. 'filter' => [
  69. 'title' => t('Has taxonomy term'),
  70. 'id' => 'taxonomy_index_tid',
  71. 'hierarchy table' => 'taxonomy_term__parent',
  72. 'numeric' => TRUE,
  73. 'skip base' => 'taxonomy_term_data',
  74. 'allow empty' => TRUE,
  75. ],
  76. 'relationship' => [
  77. 'base' => 'taxonomy_term',
  78. 'base field' => 'tid',
  79. 'label' => t('Term'),
  80. ],
  81. ];
  82. $data['forum_index']['created'] = [
  83. 'title' => t('Post date'),
  84. 'help' => t('The date the content was posted.'),
  85. 'field' => [
  86. 'id' => 'date',
  87. ],
  88. 'sort' => [
  89. 'id' => 'date',
  90. ],
  91. 'filter' => [
  92. 'id' => 'date',
  93. ],
  94. ];
  95. $data['forum_index']['sticky'] = [
  96. 'title' => t('Sticky'),
  97. 'help' => t('Whether or not the content is sticky.'),
  98. 'field' => [
  99. 'id' => 'boolean',
  100. 'click sortable' => TRUE,
  101. 'output formats' => [
  102. 'sticky' => [t('Sticky'), t('Not sticky')],
  103. ],
  104. ],
  105. 'filter' => [
  106. 'id' => 'boolean',
  107. 'label' => t('Sticky'),
  108. 'type' => 'yes-no',
  109. ],
  110. 'sort' => [
  111. 'id' => 'standard',
  112. 'help' => t('Whether or not the content is sticky. To list sticky content first, set this to descending.'),
  113. ],
  114. ];
  115. $data['forum_index']['last_comment_timestamp'] = [
  116. 'title' => t('Last comment time'),
  117. 'help' => t('Date and time of when the last comment was posted.'),
  118. 'field' => [
  119. 'id' => 'comment_last_timestamp',
  120. ],
  121. 'sort' => [
  122. 'id' => 'date',
  123. ],
  124. 'filter' => [
  125. 'id' => 'date',
  126. ],
  127. ];
  128. $data['forum_index']['comment_count'] = [
  129. 'title' => t('Comment count'),
  130. 'help' => t('The number of comments a node has.'),
  131. 'field' => [
  132. 'id' => 'numeric',
  133. ],
  134. 'filter' => [
  135. 'id' => 'numeric',
  136. ],
  137. 'sort' => [
  138. 'id' => 'standard',
  139. ],
  140. 'argument' => [
  141. 'id' => 'standard',
  142. ],
  143. ];
  144. return $data;
  145. }