public function renderVotes(Comment $comment)
{
if (!$this->options['useVotes']) {
return '';
}
$upvoteFormat = str_replace('{cnt}', "<small class='CommentUpvoteCnt'>{$comment->upvotes}</small>", $this->options['upvoteFormat']);
$upvoteURL = "{$this->page->url}?comment_success=upvote&comment_id={$comment->id}&field_id={$this->field->id}#Comment{$comment->id}";
$upvoteLabel = $this->_('Like this comment');
$downvoteFormat = str_replace('{cnt}', "<small class='CommentDownvoteCnt'>{$comment->downvotes}</small>", $this->options['downvoteFormat']);
$downvoteURL = "{$this->page->url}?comment_success=downvote&comment_id={$comment->id}&field_id={$this->field->id}#Comment{$comment->id}";
$downvoteLabel = $this->_('Dislike this comment');
// note that data-url attribute stores the href (rather than href) so that we can keep crawlers out of auto-following these links
$out = "<span class='CommentVotes'>";
$out .= "<a class='CommentActionUpvote' title='{$upvoteLabel}' data-url='{$upvoteURL}' href='#Comment{$comment->id}'>{$upvoteFormat}</a>";
if ($this->options['useVotes'] == FieldtypeComments::useVotesAll) {
$out .= "<a class='CommentActionDownvote' title='{$downvoteLabel}' data-url='{$downvoteURL}' href='#Comment{$comment->id}'>{$downvoteFormat}</a>";
}
$out .= "</span> ";
return $out;
}