diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index 039c305..5b6f3a6 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -694,26 +694,25 @@ function template_preprocess_forum_icon(&$variables) { $variables['hot_threshold'] = \Drupal::config('forum.settings')->get('topics.hot_threshold'); if ($variables['num_posts'] > $variables['hot_threshold']) { - $icon_status_class = $variables['new_posts'] ? 'hot-new' : 'hot'; + $icon_status = $variables['new_posts'] ? 'hot-new' : 'hot'; $variables['icon_title'] = $variables['new_posts'] ? t('Hot topic, new comments') : t('Hot topic'); } else { - $icon_status_class = $variables['new_posts'] ? 'new' : 'default'; + $icon_status = $variables['new_posts'] ? 'new' : 'default'; $variables['icon_title'] = $variables['new_posts'] ? t('New comments') : t('Normal topic'); } if ($variables['comment_mode'] == CommentItemInterface::CLOSED || $variables['comment_mode'] == CommentItemInterface::HIDDEN) { - $icon_status_class = 'closed'; + $icon_status = 'closed'; $variables['icon_title'] = t('Closed topic'); } if ($variables['sticky'] == 1) { - $icon_status_class = 'sticky'; + $icon_status = 'sticky'; $variables['icon_title'] = t('Sticky topic'); } - $variables['attributes']['class'][] = 'icon'; - $variables['attributes']['class'][] = 'topic-status-' . $icon_status_class; + $variables['icon_status'] = $icon_status; $variables['attributes']['title'] = $variables['icon_title']; } diff --git a/core/modules/forum/templates/forum-icon.html.twig b/core/modules/forum/templates/forum-icon.html.twig index f3447f8..64a4d2a 100644 --- a/core/modules/forum/templates/forum-icon.html.twig +++ b/core/modules/forum/templates/forum-icon.html.twig @@ -11,13 +11,20 @@ * - 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: Points which status icon should be used. * * @see template_preprocess_forum_icon() * * @ingroup themeable */ #} - +{% + set classes = [ + 'icon', + 'topic-status-' ~ icon_status, + ] +%} + {% if first_new -%} {%- endif %}