You are here

function theme_vote_up_down_points in Vote Up/Down 5

1 theme call to theme_vote_up_down_points()
vote_up_down_link in ./vote_up_down.module
Implementation of hook_link().

File

./vote_up_down.module, line 562
vote_up_down is a module that adds a widget for +1/-1 votes on nodes. It depends upon Voting API. It's based upon "simplevote.module".

Code

function theme_vote_up_down_points($cid, $type, $nodelink = FALSE) {
  $vote_result = votingapi_get_voting_result($type, $cid, 'points', variable_get('vote_up_down_tag', 'vote'), 'sum');
  if ($nodelink) {
    if ($vote_result) {
      $output = array(
        'title' => '<span id="vote_points_' . $cid . '" class="vote-points">' . format_plural($vote_result->value, '1 point', '@count points') . '</span>',
        'html' => TRUE,
      );
    }
    else {
      $output = array(
        'title' => '<span id="vote_points_' . $cid . '" class="vote-points">' . t('0 points') . '</span>',
        'html' => TRUE,
      );
    }
  }
  else {
    if ($vote_result) {
      $output = '<span id="vote_points_' . $cid . '" class="vote-points">' . format_plural($vote_result->value, '1 point', '@count points') . '</span>';
    }
    else {
      $output = '<span id="vote_points_' . $cid . '" class="vote-points">' . t('0 points') . '</span>';
    }
  }
  return $output;
}