You are here

faq-category-new-page.html.twig in Frequently Asked Questions 8

Template file for the FAQ page if set to show the categorized answer in a new page.

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