You are here

function disqus_link in Disqus 6

Same name and namespace in other branches
  1. 5 disqus.module \disqus_link()

Implementation of hook_link().

File

./disqus.module, line 252

Code

function disqus_link($type, $node = NULL, $teaser = FALSE) {
  $links = array();

  // Only show the Disqus links on node teasers.
  if ($type == 'node' && $teaser == TRUE && $node->disqus['status'] == 1) {

    // Make sure the context is correct.
    $types = variable_get('disqus_nodetypes', array());
    $domain = variable_get('disqus_domain', NULL);
    if (!empty($types[$node->type]) && user_access('view disqus comments') && !empty($domain)) {

      // Construct the path and inject it into the links area.
      $path = url("node/{$node->nid}", array(
        'alias' => TRUE,
        'absolute' => TRUE,
      ));
      $links['disqus_comments'] = array(
        'title' => theme('disqus_comments_num', $domain, $path, t('Comments'), "node/{$node->nid}"),
        'html' => TRUE,
      );
    }
  }
  return $links;
}