You are here

function theme_disqus_comments_num in Disqus 6

Renders the JavaScript to change all Disqus comment links to the correct number of comments.

Parameters

$domain: The Disqus domain associated with this account.

$path: (optional) The path of the full article of who's comments you want to display.

$text: (optional) The text to be displayed in the link.

Return value

If $path is given, will provide a rendered HTML link for the comments.

2 theme calls to theme_disqus_comments_num()
disqus_link in ./disqus.module
Implementation of hook_link().
views_handler_field_node_disqus_comments::render in include/views_handler_field_node_disqus_comments.inc
When rendering the field.

File

./disqus.module, line 560

Code

function theme_disqus_comments_num($domain, $path = NULL, $text = NULL, $identifier = NULL) {
  static $added = FALSE;
  if ($added == FALSE) {
    drupal_add_js(drupal_get_path('module', 'disqus') . '/disqus.js');
    drupal_add_js(array(
      'disqusCommentDomain' => $domain,
    ), 'setting');
    $added = TRUE;
  }
  $text = empty($text) ? t('Comments') : $text;
  if (isset($path)) {
    $attributes['class'] = 'comments disqus-comments';
    $attributes['title'] = t('Jump to the comments of this posting.');
    if (isset($identifier)) {
      $attributes['data-disqus-identifier'] = $identifier;
    }
    return l($text, $path, array(
      'attributes' => $attributes,
      'alias' => TRUE,
      'absolute' => TRUE,
      'fragment' => 'disqus_thread',
    ));
  }
}