You are here

function advanced_forum_preprocess_advanced_forum_topic_header in Advanced Forum 7.2

Same name and namespace in other branches
  1. 5 advanced_forum.module \advanced_forum_preprocess_advanced_forum_topic_header()
  2. 6.2 includes/theme.inc \advanced_forum_preprocess_advanced_forum_topic_header()
  3. 6 advanced_forum.module \advanced_forum_preprocess_advanced_forum_topic_header()

Preprocesses template variables for the topic header template.

File

includes/theme.inc, line 435
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);
  $node = $variables['node'];

  // Reply link/button.
  $variables['reply_link'] = theme('advanced_forum_reply_link', array(
    'node' => $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.
  $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);

  // Pager.
  if (isset($variables['node']->comment_count)) {
    pager_default_initialize($variables['node']->comment_count, variable_get('comment_default_per_page_' . $variables['node']->type, 50));
  }
  $variables['pager'] = theme('pager');
}