You are here

function _fb_social_comments_link in Facebook social plugins integration 6.2

Same name and namespace in other branches
  1. 7.2 plugins/fb_plugin/comments.inc \_fb_social_comments_link()

Pseudo hook_link for this plugin

1 string reference to '_fb_social_comments_link'
comments.inc in plugins/fb_plugin/comments.inc

File

plugins/fb_plugin/comments.inc, line 218

Code

function _fb_social_comments_link($preset, $type, $object, $teaser = FALSE) {
  $links = array();
  if (!$teaser || 'node' != $type) {
    return $links;
  }
  if (!fb_social_preset_node_types($preset, $object->type)) {
    return $links;
  }
  if (!$preset->settings['plugin_comments_count']['count']) {
    return $links;
  }
  $link_url = fb_social_url('node/' . $object->nid);
  $nr_comments = _fb_social_comments_comments_count($link_url, $preset);
  if ($nr_comments) {
    $link_title = format_plural($nr_comments, '1 comment', '@count comments');
    $links['fb-social-' . $preset->name . 'comments-count'] = array(
      'title' => $link_title,
      'href' => fb_social_url('node/' . $object->nid),
      'html' => TRUE,
    );
  }
  return $links;
}