You are here

faqfield-anchor-list-formatter.html.twig in FAQ Field 8

Same filename and directory in other branches
  1. 2.0.x templates/faqfield-anchor-list-formatter.html.twig

Default theme implementation of a FAQ Field definition list formatter.

Available variables:

  • items: An array of objects with the following fields.

    • question: Prefiltered question value by check_plain.
    • answer: Prefiltered answer value by field setting format.
    • name: String to be used as anchor name.

File

templates/faqfield-anchor-list-formatter.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation of a FAQ Field definition list formatter.
  5. *
  6. * Available variables:
  7. * - items: An array of objects with the following fields.
  8. * - question: Prefiltered question value by check_plain.
  9. * - answer: Prefiltered answer value by field setting format.
  10. * - name: String to be used as anchor name.
  11. *
  12. * @see template_preprocess()
  13. * @see template_preprocess_faqfield_anchor_list_formatter()
  14. *
  15. * @ingroup themeable
  16. */
  17. #}
  18. {% spaceless %}
  19. <div class="faqfield-anchor-list">
  20. <{{ list_type }}>
  21. {% for item in items %}
  22. <li><a href="#{{ item.name }}">{{ item.question }}</a></li>
  23. {% endfor %}
  24. </{{ list_type }}>
  25. {% for item in items %}
  26. <h3 class="faqfield-question">
  27. <a href="#{{ item.name }}" name="{{ item.name }}">{{ item.question }}</a>
  28. </h3>
  29. <div class="faqfield-answer">{{ item.answer }}</div>
  30. {% endfor %}
  31. </div>
  32. {% endspaceless %}