You are here

function theme_advanced_forum_reply_link in Advanced Forum 7.2

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

Theme function to format the reply link at the top/bottom of topic.

3 theme calls to theme_advanced_forum_reply_link()
advanced_forum_preprocess_advanced_forum_topic_header in includes/theme.inc
Preprocesses template variables for the topic header template.
advanced_forum_preprocess_comment_wrapper in includes/theme.inc
Preprocess comment wrapper.
_advanced_forum_preprocess_node in includes/advanced_forum_preprocess_node.inc
Preprocess node.

File

includes/theme.inc, line 91
Holds theme functions and template preprocesses. Other style related functions are in style.inc

Code

function theme_advanced_forum_reply_link(&$variables) {
  $node = $variables['node'];

  // Get the information about whether the user can reply and the link to do
  // so if the user is allowed to.
  $reply_link = advanced_forum_get_reply_link($node);
  if (is_array($reply_link)) {

    // Reply is allowed. Variable contains the link information.
    $output = '<div class="topic-reply-allowed">';
    $output .= theme('advanced_forum_l', array(
      'text' => $reply_link['title'],
      'path' => $reply_link['href'],
      'options' => $reply_link['options'],
      'button_class' => 'large',
    ));
    $output .= '</div>';
    return $output;
  }
  elseif ($reply_link == 'reply-locked') {

    // @TODO: The double span here is icky but I don't know how else to get
    // around the fact that there's no "a" to put the button class on.
    return '<div class="topic-reply-locked"><span class="af-button-large"><span>' . t('Topic locked') . '</span></span></div>';
  }
  elseif ($reply_link == 'reply-forbidden') {

    // User is not allowed to reply to this topic.
    return theme('comment_post_forbidden', array(
      'node' => $node,
    ));
  }
}