faq-category-questions-top-answers.tpl.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <?php
  2. /**
  3. * @file
  4. * Template file for the answers 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_answers
  11. * Whether or not there should be any output.
  12. * $display_header
  13. * Boolean value controlling whether a header should be displayed.
  14. * $header_title
  15. * The category title.
  16. * $category_name
  17. * The name of the category.
  18. * $answer_category_name
  19. * Whether the category name should be displayed with the answers.
  20. * $group_questions_top
  21. * Whether the questions and answers should be grouped together.
  22. * $category_depth
  23. * The term or category depth.
  24. * $description
  25. * The current page's description.
  26. * $term_image
  27. * The HTML for the category image. This is empty if the taxonomy image module
  28. * is not enabled or there is no image associated with the term.
  29. * $display_faq_count
  30. * Boolean value controlling whether or not the number of faqs in a category
  31. * should be displayed.
  32. * $question_count
  33. * The number of questions in category.
  34. * $nodes
  35. * An array of nodes to be displayed.
  36. * Each node stored in the $nodes array has the following information:
  37. * $node['question'] is the question text.
  38. * $node['body'] is the answer text.
  39. * $node['links'] represents the node links, e.g. "Read more".
  40. * $use_teaser
  41. * Whether $node['body'] contains the full body or just the teaser text.
  42. * $question_label
  43. * The question label, intended to be pre-pended to the question text.
  44. * $answer_label
  45. * The answer label, intended to be pre-pended to the answer text.
  46. * $container_class
  47. * The class attribute of the element containing the sub-categories, either
  48. * 'faq-qa' or 'faq-qa-hide'. This is used by javascript to open/hide
  49. * a category's faqs.
  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. $depth = 0;
  62. // @codingStandardsIgnoreEnd
  63. ?>
  64. <?php if ($display_answers): ?>
  65. <?php if ($answer_category_name): ?>
  66. <?php while ($depth < $category_depth): ?>
  67. <div class="faq-category-indent">
  68. <?php $depth++; endwhile; ?>
  69. <?php endif; ?>
  70. <div class="faq-category-menu">
  71. <?php if ($display_header): ?>
  72. <<?php print $hdr; ?> class="faq-header">
  73. <?php print $term_image; ?>
  74. <?php print $category_name; ?>
  75. </<?php print $hdr; ?>>
  76. <div class="clear-block"></div>
  77. <div class="faq-category-group">
  78. <div>
  79. <?php endif; ?>
  80. <?php if (!$answer_category_name || $display_header): ?>
  81. <!-- Include subcategories. -->
  82. <?php if (count($subcat_body_list)): ?>
  83. <?php foreach ($subcat_body_list as $i => $subcat_html): ?>
  84. <?php print $subcat_html; ?>
  85. <?php endforeach; ?>
  86. <?php endif; ?>
  87. <?php if (!$display_header): ?>
  88. <div class="faq-category-group">
  89. <div>
  90. <?php endif; ?>
  91. <!-- List questions (in title link) and answers (in body). -->
  92. <?php if (count($nodes)): ?>
  93. <?php foreach ($nodes as $i => $node): ?>
  94. <div class="faq-question">
  95. <?php if (!empty($question_label)): ?>
  96. <strong class="faq-question-label">
  97. <?php print $question_label; ?>
  98. </strong>
  99. <?php endif; ?>
  100. <?php print $node['question']; ?>
  101. </div> <!-- Close div: faq-question -->
  102. <div class="faq-answer">
  103. <?php if (!empty($answer_label)): ?>
  104. <strong class="faq-answer-label">
  105. <?php print $answer_label; ?>
  106. </strong>
  107. <?php endif; ?>
  108. <?php print $node['body']; ?>
  109. <?php if (isset($node['links'])): ?>
  110. <?php print $node['links']; ?>
  111. <?php endif; ?>
  112. </div> <!-- Close div: faq-answer -->
  113. <?php endforeach; ?>
  114. <?php endif; ?>
  115. <?php endif; ?>
  116. </div> <!-- Close div -->
  117. </div> <!-- Close div: faq-category-group -->
  118. </div>
  119. <?php if ($answer_category_name): ?>
  120. <?php while ($depth > 0): ?>
  121. </div> <!-- Close div: faq-category-indent -->
  122. <?php $depth--; endwhile; ?>
  123. <?php endif; ?>
  124. <?php endif; ?>