forum-topic-list.html.twig

Default theme implementation to display a list of forum topics.

Available variables:

  • header: The table header. This is pre-generated with click-sorting information. If you need to change this, see template_preprocess_forum_topic_list().
  • pager: The pager to display beneath the table.
  • topics: A collection of topics to be displayed. Each topic in topics contains:

    • icon: The icon to display.
    • moved: A flag to indicate whether the topic has been moved to another forum.
    • title: The title of the topic. Safe to output.
    • message: If the topic has been moved, this contains an explanation and a link.
    • zebra: 'even' or 'odd', used for row class.
    • comment_count: The number of replies on this topic.
    • new_replies: A flag to indicate whether there are unread comments.
    • new_url: If there are unread replies, this is a link to them.
    • new_text: Text containing the translated, properly pluralized count.
    • created: Text representing when the topic was posted. Safe to output.
    • last_reply: Text representing when the topic was last replied to.
    • timestamp: The raw timestamp this topic was posted.
  • topic_id: Numeric ID for the current forum topic.

See also

template_preprocess()

template_preprocess_forum_topic_list()

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

File

drupal/core/modules/forum/templates/forum-topic-list.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation to display a list of forum topics.
  5. *
  6. * Available variables:
  7. * - header: The table header. This is pre-generated with click-sorting
  8. * information. If you need to change this, see
  9. * template_preprocess_forum_topic_list().
  10. * - pager: The pager to display beneath the table.
  11. * - topics: A collection of topics to be displayed. Each topic in topics
  12. * contains:
  13. * - icon: The icon to display.
  14. * - moved: A flag to indicate whether the topic has been moved to another
  15. * forum.
  16. * - title: The title of the topic. Safe to output.
  17. * - message: If the topic has been moved, this contains an explanation and a
  18. * link.
  19. * - zebra: 'even' or 'odd', used for row class.
  20. * - comment_count: The number of replies on this topic.
  21. * - new_replies: A flag to indicate whether there are unread comments.
  22. * - new_url: If there are unread replies, this is a link to them.
  23. * - new_text: Text containing the translated, properly pluralized count.
  24. * - created: Text representing when the topic was posted. Safe to output.
  25. * - last_reply: Text representing when the topic was last replied to.
  26. * - timestamp: The raw timestamp this topic was posted.
  27. * - topic_id: Numeric ID for the current forum topic.
  28. *
  29. * @see template_preprocess()
  30. * @see template_preprocess_forum_topic_list()
  31. *
  32. * @ingroup themeable
  33. */
  34. #}
  35. <table id="forum-topic-{{ topic_id }}">
  36. <thead>
  37. <tr>{{ header }}</tr>
  38. </thead>
  39. <tbody>
  40. {% for topic in topics %}
  41. <tr class="{{ topic.zebra }}">
  42. <td class="topic">
  43. {{ topic.icon }}
  44. <div class="title">
  45. <div>
  46. {{ topic.title }}
  47. </div>
  48. <div>
  49. {{ topic.created }}
  50. </div>
  51. </div>
  52. </td>
  53. {% if topic.moved %}
  54. <td colspan="3">{{ topic.message }}</td>
  55. {% else %}
  56. <td class="replies">
  57. {{ topic.comment_count }}
  58. {% if topic.new_replies %}
  59. <br />
  60. <a href="{{ topic.new_url }}">{{ topic.new_text }}</a>
  61. {% endif %}
  62. </td>
  63. <td class="last-reply">{{ topic.last_reply }}</td>
  64. {% endif %}
  65. </tr>
  66. {% endfor %}
  67. </tbody>
  68. </table>
  69. {{ pager }}

Related topics