function advanced_forum_preprocess_advanced_forum_topic_header in Advanced Forum 6.2
Same name and namespace in other branches
- 5 advanced_forum.module \advanced_forum_preprocess_advanced_forum_topic_header()
- 6 advanced_forum.module \advanced_forum_preprocess_advanced_forum_topic_header()
- 7.2 includes/theme.inc \advanced_forum_preprocess_advanced_forum_topic_header()
Preprocesses template variables for the topic header template.
File
- includes/
theme.inc, line 401 - Holds theme functions and template preprocesses. Other style related functions are in style.inc
Code
function advanced_forum_preprocess_advanced_forum_topic_header(&$variables) {
advanced_forum_add_template_suggestions("topic-header", $variables['template_files']);
$node = $variables['node'];
// Form to search within the topic. (only works with nodecomment)
$variables['search'] = theme('advanced_forum_search_topic', $variables['node']);
// Reply link / button
$variables['reply_link'] = theme('advanced_forum_reply_link', $node);
// Total posts, including first post.
$posts = empty($variables['comment_count']) ? 1 : $variables['comment_count'] + 1;
$variables['total_posts_count'] = format_plural($posts, '1 post', '@count posts');
// Number of new posts on topic.
$variables['new_posts_count'] = advanced_forum_reply_num_new($node->nid);
// Link to first new post only if the new post isn't the topic starter.
$variables['first_new_post_link'] = '';
if ($posts > 1) {
$variables['first_new_post_link'] = advanced_forum_first_new_post_link($variables['node'], $variables['comment_count']);
}
// Link to last post in topic.
$variables['last_post_link'] = advanced_forum_last_post_link($node);
}