Commit a5d36eff authored by alexpott's avatar alexpott
Browse files

Issue #2329769 by lauriii, mortendk | davidhernandez: Move forum classes from...

Issue #2329769 by lauriii, mortendk | davidhernandez: Move forum classes from preprocess to templates.
parent 3bb1ac58
......@@ -683,26 +683,24 @@ 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';
$variables['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';
$variables['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';
$variables['icon_status'] = 'closed';
$variables['icon_title'] = t('Closed topic');
}
if ($variables['sticky'] == 1) {
$icon_status_class = 'sticky';
$variables['icon_status'] = 'sticky';
$variables['icon_title'] = t('Sticky topic');
}
$variables['attributes']['class'][] = 'icon';
$variables['attributes']['class'][] = 'topic-status-' . $icon_status_class;
$variables['attributes']['title'] = $variables['icon_title'];
}
......
......@@ -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: Indicates which status icon should be used.
*
* @see template_preprocess_forum_icon()
*
* @ingroup themeable
*/
#}
<div{{ attributes }}>
{%
set classes = [
'icon',
'topic-status-' ~ icon_status,
]
%}
<div{{ attributes.addClass(classes) }}>
{% if first_new -%}
<a id="new"></a>
{%- endif %}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment