You are here

faq-category-questions-inline.html.twig in Frequently Asked Questions 8

Template file for the FAQ page if set to show categorized questions inline.

Available variables:

  • display_header: Boolean value controlling whether a header should be displayed.
  • header_title: The category title.
  • category_depth: The term or category depth.
  • description: The current page's description.
  • term_image: The HTML for the category image. This is empty if the taxonomy image module is not enabled or there is no image associated with the term.
  • display_faq_count: Boolean value controlling whether or not the number of faqs in a category should be displayed.
  • question_count: The number of questions in category.
  • nodes: The array of nodes to be displayed. Each node stored in the $nodes array has the following information:
    • question: The question text.
    • body: The answer text.
    • links: Represents the node links, e.g. "Read more".
  • question_label: The question label, intended to be pre-pended to the question text.
  • answer_label: The answer label, intended to be pre-pended to the answer text.
  • use_teaser: Tells whether $node['body'] contains the full body or just the teaser
  • container_class: The class attribute of the element containing the sub-categories, either 'faq-qa' or 'faq-qa-hide'. This is used by javascript to open/hide a category's faqs.
  • subcat_list: An array of sub-categories. Each sub-category stored in the $subcat_list array has the following information:

    • link: The link to the sub-category.
    • description: The sub-category description.
    • count: The number of questions in the sub-category.
    • term_image: The sub-category (taxonomy) image.
  • subcat_list_style: The style of the sub-category list, either ol or ul (ordered or unordered).
  • subcat_body_list: The sub-categories faqs, recursively themed (by this template).

File

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