You are here

function template_preprocess_talkpage in Talk 6

Same name and namespace in other branches
  1. 7 talk.module \template_preprocess_talkpage()

Template preprocess function.

Parameters

$node: The node whose talk page is being displayed.

$add_comments: Boolean that indicates if adding comments is allowed for current user.

File

./talk.module, line 268
Comments are displayed in a separate 'talk' tab, for node types you wish

Code

function template_preprocess_talkpage(&$variables) {
  $add_comments = $variables['add_comments'];
  $node = $variables['node'];
  $variables['title'] = talk_title($node, 'page');
  $comment_link = '';
  $redisplay = FALSE;
  if ($add_comments) {
    if (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
      $comment_link = l(t('Add new comment'), 'comment/reply/' . $node->nid, array(
        'fragment' => 'comment-form',
      ));
    }
    elseif ($node->comment_count > 1) {
      $comment_link = l(t('Add new comment'), check_plain($_GET['q']), array(
        'fragment' => 'comment-form',
      ));
      $redisplay = TRUE;
    }
  }
  $comments = theme('talk_comments', $node);
  $variables['redisplay'] = $redisplay;
  $variables['comment_link'] = $comment_link;
  $variables['comments'] = $comments;
}