faq-category-questions-top.tpl.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <?php
  2. /**
  3. * @file
  4. * Template file for the questions section of the FAQ page if set to show
  5. * categorized questions at the top of the page.
  6. */
  7. /**
  8. * Available variables:
  9. *
  10. * $display_header
  11. * Boolean value controlling whether a header should be displayed.
  12. * $header_title
  13. * The category title.
  14. * $category_name
  15. * The name of the category.
  16. * $answer_category_name
  17. * Whether the category name should be displayed with the answers.
  18. * $group_questions_top
  19. * Whether the questions and answers should be grouped together.
  20. * $category_depth
  21. * The term or category depth.
  22. * $description
  23. * The current page's description.
  24. * $term_image
  25. * The HTML for the category image. This is empty if the taxonomy image module
  26. * is not enabled or there is no image associated with the term.
  27. * $display_faq_count
  28. * Boolean value controlling whether or not the number of faqs in a category
  29. * should be displayed.
  30. * $question_count
  31. * The number of questions in category.
  32. * $nodes
  33. * An array of nodes to be displayed.
  34. * Each node stored in the $nodes array has the following information:
  35. * $node['question'] is the question text.
  36. * $node['body'] is the answer text.
  37. * $node['links'] represents the node links, e.g. "Read more".
  38. * $use_teaser
  39. * Whether $node['body'] contains the full body or just the teaser text.
  40. * $container_class
  41. * The class attribute of the element containing the sub-categories, either
  42. * 'faq-qa' or 'faq-qa-hide'. This is used by javascript to open/hide
  43. * a category's faqs.
  44. * $question_list
  45. * An array of question links.
  46. * $question_list_style
  47. * The style of the question list, ul for unordered, ol for ordered.
  48. * $subcat_list
  49. * An array of sub-categories. Each sub-category stored in the $subcat_list
  50. * array has the following information:
  51. * $subcat['link'] is the link to the sub-category.
  52. * $subcat['description'] is the sub-category description.
  53. * $subcat['count'] is the number of questions in the sub-category.
  54. * $subcat['term_image'] is the sub-category (taxonomy) image.
  55. * $subcat_list_style
  56. * The style of the sub-category list, either ol or ul (ordered or unordered).
  57. * $subcat_body_list
  58. * The sub-categories faqs, recursively themed (by this template).
  59. */
  60. // @todo should be moved to better place.
  61. // @codingStandardsIgnoreStart
  62. if ($category_depth > 0) {
  63. $hdr = 'h4';
  64. }
  65. else {
  66. $hdr = 'h3';
  67. }
  68. // @codingStandardsIgnoreEnd
  69. ?>
  70. <a id="faq-top"></a>
  71. <div class="faq-category-menu">
  72. <!-- category header with title, link, image, description, and count of questions inside -->
  73. <div class="faq-qa-header">
  74. <?php if ($display_header): ?>
  75. <<?php print $hdr; ?> class="faq-header">
  76. <?php print $term_image; ?>
  77. <?php print $header_title; ?>
  78. <?php if ($display_faq_count): ?>
  79. (<?php print $question_count; ?>)
  80. <?php endif; ?>
  81. </<?php print $hdr; ?>>
  82. <?php else: ?>
  83. <?php print $term_image; ?>
  84. <?php endif; ?>
  85. <?php if (!empty($description)): ?>
  86. <div class="faq-qa-description"><?php print $description ?></div>
  87. <?php endif; ?>
  88. <?php if (!empty($term_image)): ?>
  89. <div class="clear-block"></div>
  90. <?php endif; ?>
  91. </div> <!-- Close div: faq-qa-header -->
  92. <?php if (!empty($subcat_list)): ?>
  93. <!-- list subcategories, with title, link, description, count -->
  94. <div class="item-list">
  95. <<?php print $subcat_list_style; ?> class="faq-category-list">
  96. <?php foreach ($subcat_list as $i => $subcat): ?>
  97. <li>
  98. <?php print $subcat['link']; ?>
  99. <?php if ($display_faq_count): ?>
  100. (<?php print $subcat['count']; ?>)
  101. <?php endif; ?>
  102. <?php if (!empty($subcat['description'])): ?>
  103. <div class="faq-qa-description"><?php print $subcat['description']; ?></div>
  104. <?php endif; ?>
  105. <div class="clear-block"></div>
  106. </li>
  107. <?php endforeach; ?>
  108. </<?php print $subcat_list_style; ?>>
  109. </div> <!-- Close div: item-list -->
  110. <?php endif; ?>
  111. <div class="<?php print $container_class; ?>">
  112. <?php /* Include subcategories. */ ?>
  113. <?php if (count($subcat_body_list)): ?>
  114. <?php foreach ($subcat_body_list as $i => $subcat_html): ?>
  115. <div class="faq-category-indent"><?php print $subcat_html; ?></div>
  116. <?php endforeach; ?>
  117. <?php endif; ?>
  118. <?php /* List question links. */ ?>
  119. <?php if (!empty($question_list)): ?>
  120. <div class="item-list">
  121. <<?php print $question_list_style; ?> class="faq-ul-questions-top">
  122. <?php foreach ($question_list as $i => $question_link): ?>
  123. <li>
  124. <?php print $question_link; ?>
  125. </li>
  126. <?php endforeach; ?>
  127. </<?php print $question_list_style; ?>>
  128. </div> <!-- Close div: item-list -->
  129. <?php endif; ?>
  130. <?php if (!$group_questions_top && $category_display != 'hide_qa'): ?>
  131. </div> <!-- Close div: faq-qa / faq-qa-hide -->
  132. </div> <!-- Close div: faq-category-menu -->
  133. <?php endif; ?>
  134. <?php if ($answer_category_name): ?>
  135. <!-- Display header before answers in some layouts. -->
  136. <<?php print $hdr; ?> class="faq-header">
  137. <?php print $term_image; ?>
  138. <?php print $category_name; ?>
  139. </<?php print $hdr; ?>>
  140. <div class="clear-block"></div>
  141. <?php endif; ?>
  142. <?php /* List questions (in title link) and answers (in body). */ ?>
  143. <div class="faq-category-group">
  144. <div>
  145. <?php if (count($nodes)): ?>
  146. <?php foreach ($nodes as $i => $node): ?>
  147. <div class="faq-question">
  148. <?php if (!empty($question_label)) : ?>
  149. <strong class="faq-question-label">
  150. <?php print $question_label; ?>
  151. </strong>
  152. <?php endif; ?>
  153. <?php print $node['question']; ?>
  154. </div> <!-- Close div: faq-question -->
  155. <div class="faq-answer">
  156. <?php if (!empty($answer_label)) : ?>
  157. <strong class="faq-answer-label">
  158. <?php print $answer_label; ?>
  159. </strong>
  160. <?php endif; ?>
  161. <?php print $node['body']; ?>
  162. <?php if (isset($node['links'])): ?>
  163. <?php print $node['links']; ?>
  164. <?php endif; ?>
  165. </div> <!-- Close div: faq-answer -->
  166. <?php endforeach; ?>
  167. <?php endif; ?>
  168. </div> <!-- Close div -->
  169. </div> <!-- Close div: faq-category-group -->
  170. <?php if ($group_questions_top || $category_display == 'hide_qa'): ?>
  171. </div> <!-- Close div: faq-qa / faq-qa-hide -->
  172. </div> <!-- Close div: faq-category-menu -->
  173. <?php endif; ?>