faq-category-hide-answer.tpl.php 4.6 KB

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