You are here

faq-hide-answer.html.twig in Frequently Asked Questions 8

Template file for the FAQ page if set to show/hide the answers when the question is clicked.

Available variables:

  • 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".
  • use_teaser: Tells whether node.body contains the full body or just the teaser

File

templates/faq-hide-answer.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Template file for the FAQ page if set to show/hide the answers when the
  5. * question is clicked.
  6. *
  7. * Available variables:
  8. * - nodes: The array of nodes to be displayed. Each node stored in the $nodes array has the following information:
  9. * - question: The question text.
  10. * - body: The answer text.
  11. * - links: Represents the node links, e.g. "Read more".
  12. * - use_teaser: Tells whether node.body contains the full body or just the teaser
  13. *
  14. * @see template_preprocess_faq_hide_answer()
  15. *
  16. * @ingroup themable
  17. */
  18. #}
  19. <div>
  20. {% if nodes|length > 0 %}
  21. {% for node in nodes %}
  22. <div class="faq-question-answer">
  23. <div class="faq-question faq-dt-hide-answer">
  24. {{ node.question }}
  25. </div><!-- Close div: faq-question faq-dt-hide-answer -->
  26. <div class="faq-answer faq-dd-hide-answer">
  27. {{ node.body }}
  28. {% if node.links is defined %}
  29. {{ node.links }}
  30. {% endif %}
  31. </div><!-- Close div: faq-answer faq-dd-hide-answer -->
  32. </div><!-- Close div: faq-question-answer -->
  33. {% endfor %}
  34. {% endif %}
  35. </div><!-- Close div -->