faq.views.inc 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <?php
  2. /**
  3. * @file
  4. * Provides the view implementation.
  5. */
  6. /**
  7. * Implements hook_views_data().
  8. */
  9. function faq_views_data() {
  10. // faq_questions table.
  11. $data['faq_questions']['table']['group'] = t('FAQ');
  12. $data['faq_questions']['table']['join'] = array(
  13. 'node' => array(
  14. 'left_field' => 'vid',
  15. 'field' => 'vid',
  16. ),
  17. );
  18. $data['faq_questions']['question'] = array(
  19. 'title' => t('FAQ short question'),
  20. 'help' => t('The short question text for FAQ nodes.'),
  21. 'field' => array(
  22. 'handler' => 'views_handler_field',
  23. 'click sortable' => TRUE,
  24. ),
  25. 'sort' => array(
  26. 'handler' => 'views_handler_sort',
  27. ),
  28. 'filter' => array(
  29. 'handler' => 'views_handler_filter_string',
  30. ),
  31. );
  32. $data['faq_questions']['detailed_question'] = array(
  33. 'title' => t('FAQ detailed question'),
  34. 'help' => t('The long question text for FAQ nodes.'),
  35. 'field' => array(
  36. 'handler' => 'views_handler_field',
  37. 'click sortable' => TRUE,
  38. ),
  39. 'sort' => array(
  40. 'handler' => 'views_handler_sort',
  41. ),
  42. 'filter' => array(
  43. 'handler' => 'views_handler_filter_string',
  44. ),
  45. );
  46. // faq_weights table.
  47. $data['faq_weights']['table']['group'] = t('FAQ');
  48. $data['faq_weights']['table']['join'] = array(
  49. 'node' => array(
  50. 'left_field' => 'nid',
  51. 'field' => 'nid',
  52. ),
  53. 'taxonomy_term_data' => array(
  54. 'left_field' => 'tid',
  55. 'field' => 'tid',
  56. ),
  57. );
  58. $data['faq_weights']['weight'] = array(
  59. 'title' => t('FAQ weight'),
  60. 'help' => t('The weight of the FAQ node.'),
  61. 'field' => array(
  62. 'handler' => 'views_handler_field_numeric',
  63. 'click sortable' => TRUE,
  64. ),
  65. 'sort' => array(
  66. 'handler' => 'views_handler_sort',
  67. ),
  68. 'filter' => array(
  69. 'handler' => 'views_handler_filter_numeric',
  70. ),
  71. );
  72. $data['faq_weights']['tid'] = array(
  73. 'title' => t('FAQ category tid'),
  74. 'help' => t('The tid of the FAQ node.'),
  75. 'field' => array(
  76. 'handler' => 'views_handler_field_numeric',
  77. 'click sortable' => TRUE,
  78. 'zero is null' => FALSE,
  79. ),
  80. 'filter' => array(
  81. 'title' => t('Tid'),
  82. 'handler' => 'views_handler_filter_numeric',
  83. 'hierarchy table' => 'taxonomy_term_hierarchy',
  84. 'numeric' => TRUE,
  85. 'skip base' => 'taxonomy_term_data',
  86. 'allow empty' => TRUE,
  87. 'zero is null' => FALSE,
  88. ),
  89. 'relationship' => array(
  90. 'handler' => 'views_handler_relationship',
  91. 'label' => t('category'),
  92. 'base' => 'taxonomy_index',
  93. 'base field' => 'tid',
  94. 'skip base' => 'taxonomy_term_data',
  95. ),
  96. );
  97. $data['faq_weights']['category'] = array(
  98. 'title' => t('FAQ category'),
  99. 'help' => t('The term of the FAQ node.'),
  100. 'real field' => 'tid',
  101. 'field' => array(
  102. 'handler' => 'views_handler_field_term_node_tid',
  103. 'click sortable' => TRUE,
  104. 'zero is null' => TRUE,
  105. ),
  106. 'argument' => array(
  107. 'handler' => 'views_handler_argument_term_node_tid',
  108. 'name table' => 'taxonomy_term_data',
  109. 'name field' => 'name',
  110. 'empty field name' => t('Uncategorized'),
  111. 'numeric' => TRUE,
  112. 'skip base' => 'taxonomy_term_data',
  113. 'zero is null' => TRUE,
  114. ),
  115. 'filter' => array(
  116. 'title' => t('Term'),
  117. 'handler' => 'views_handler_filter_term_node_tid',
  118. 'hierarchy table' => 'taxonomy_term_hierarchy',
  119. 'numeric' => TRUE,
  120. 'skip base' => 'taxonomy_term_data',
  121. 'allow empty' => TRUE,
  122. 'zero is null' => FALSE,
  123. ),
  124. );
  125. return $data;
  126. }