You are here

faq-questions-top.html.twig in Frequently Asked Questions 8

Template file for the FAQ page if set to show the questions in a list at the top

Available variables:

  • questions_list: Pre-formatted list of questions.
  • questions: An array of questions to use for producing the question list at the top.
  • answers: An array of answers to use for producing the main body of text.
    • question: The question text.
    • body: The answer text.
    • links: Represents the node links, e.g. "Read more".
  • use_teaser: Is true if $answer['body'] is a teaser.
  • list_style: Represents the style of list, ul for unordered, ol for ordered.
  • 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.
  • limit: Represents the number of items.

File

templates/faq-questions-top.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Template file for the FAQ page if set to show the questions
  5. * in a list at the top
  6. *
  7. * Available variables:
  8. * - questions_list: Pre-formatted list of questions.
  9. * - questions: An array of questions to use for producing the question list at the top.
  10. * - answers: An array of answers to use for producing the main body of text.
  11. * - question: The question text.
  12. * - body: The answer text.
  13. * - links: Represents the node links, e.g. "Read more".
  14. * - use_teaser: Is true if $answer['body'] is a teaser.
  15. * - list_style: Represents the style of list, ul for unordered, ol for ordered.
  16. * - question_label: The question label, intended to be pre-pended to the question text.
  17. * - answer_label: The answer label, intended to be pre-pended to the answer text.
  18. * - limit: Represents the number of items.
  19. *
  20. * @see template_preprocess_faq_questions_top()
  21. *
  22. * @ingroup themable
  23. */
  24. #}
  25. <a id="top"></a>
  26. {{ questions_list }}
  27. <br />
  28. {% for item in answers|slice(0, limit) %}
  29. <div class="faq-question">
  30. {% if question_label is not empty %}
  31. <strong class="faq-question-label">
  32. {{ question_label }}
  33. </strong>
  34. {% endif %}
  35. {{ item.question }}
  36. </div>
  37. <div class="faq-answer">
  38. {% if answer_label is not empty %}
  39. <strong class="faq-answer-label">
  40. {{ answer_label }}
  41. </strong>
  42. {% endif %}
  43. {{ item.body }}
  44. {{ item.links }}
  45. </div>
  46. {% endfor %}