forum-icon.html.twig

Same filename in this branch
  1. 8.9.x core/themes/seven/templates/classy/dataset/forum-icon.html.twig
  2. 8.9.x core/themes/claro/templates/classy/dataset/forum-icon.html.twig
  3. 8.9.x core/themes/bartik/templates/classy/dataset/forum-icon.html.twig
  4. 8.9.x core/themes/stable/templates/dataset/forum-icon.html.twig
  5. 8.9.x core/themes/classy/templates/dataset/forum-icon.html.twig
  6. 8.9.x core/modules/forum/templates/forum-icon.html.twig
Same filename and directory in other branches
  1. 9 core/profiles/demo_umami/themes/umami/templates/classy/dataset/forum-icon.html.twig
  2. 9 core/themes/stable9/templates/dataset/forum-icon.html.twig
  3. 9 core/themes/seven/templates/classy/dataset/forum-icon.html.twig
  4. 9 core/themes/claro/templates/classy/dataset/forum-icon.html.twig
  5. 9 core/themes/bartik/templates/classy/dataset/forum-icon.html.twig
  6. 9 core/themes/stable/templates/dataset/forum-icon.html.twig
  7. 9 core/themes/classy/templates/dataset/forum-icon.html.twig
  8. 9 core/modules/forum/templates/forum-icon.html.twig
  9. 10 core/profiles/demo_umami/themes/umami/templates/classy/dataset/forum-icon.html.twig
  10. 10 core/themes/stable9/templates/dataset/forum-icon.html.twig
  11. 10 core/themes/claro/templates/classy/dataset/forum-icon.html.twig
  12. 10 core/modules/forum/templates/forum-icon.html.twig
  13. 11.x core/profiles/demo_umami/themes/umami/templates/classy/dataset/forum-icon.html.twig
  14. 11.x core/themes/stable9/templates/dataset/forum-icon.html.twig
  15. 11.x core/themes/claro/templates/classy/dataset/forum-icon.html.twig
  16. 11.x core/modules/forum/templates/forum-icon.html.twig

Theme override to display a status icon for a forum post.

Available variables:

  • attributes: HTML attributes to be applied to the wrapper element.

    • class: HTML classes that determine which icon to display. May be one of 'hot', 'hot-new', 'new', 'default', 'closed', or 'sticky'.
    • title: Text alternative for the forum icon.
  • icon_title: Text alternative for the forum icon, same as above.
  • new_posts: '1' when this topic contains new posts, otherwise '0'.
  • first_new: '1' when this is the first topic with new posts, otherwise '0'.
  • icon_status: Indicates which status icon should be used.

See also

template_preprocess_forum_icon()

1 theme call to forum-icon.html.twig
template_preprocess_forums in core/modules/forum/forum.module
Prepares variables for forums templates.

File

core/profiles/demo_umami/themes/umami/templates/classy/dataset/forum-icon.html.twig

View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override to display a status icon for a forum post.
  5. *
  6. * Available variables:
  7. * - attributes: HTML attributes to be applied to the wrapper element.
  8. * - class: HTML classes that determine which icon to display. May be one of
  9. * 'hot', 'hot-new', 'new', 'default', 'closed', or 'sticky'.
  10. * - title: Text alternative for the forum icon.
  11. * - icon_title: Text alternative for the forum icon, same as above.
  12. * - new_posts: '1' when this topic contains new posts, otherwise '0'.
  13. * - first_new: '1' when this is the first topic with new posts, otherwise '0'.
  14. * - icon_status: Indicates which status icon should be used.
  15. *
  16. * @see template_preprocess_forum_icon()
  17. */
  18. #}
  19. {%
  20. set classes = [
  21. 'forum__icon',
  22. 'forum__topic-status--' ~ icon_status,
  23. ]
  24. %}
  25. <div{{ attributes.addClass(classes) }}>
  26. {% if first_new -%}
  27. <a id="new"></a>
  28. {%- endif %}
  29. <span class="visually-hidden">{{ icon_title }}</span>
  30. </div>

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.