faq-category-questions-inline.tpl.php 4.9 KB

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