You are here

function addthis_link in AddThis 6.3

Same name and namespace in other branches
  1. 5.2 addthis.module \addthis_link()
  2. 6 addthis.module \addthis_link()
  3. 6.2 addthis.module \addthis_link()

Implementation of hook_link().

File

./addthis.module, line 65
Provides integration with the AddThis.com bookmarking & sharing service.

Code

function addthis_link($type, $node = NULL, $teaser = FALSE) {

  // Check whether AddThis is set to display on this node.
  if ($type != 'node') {
    return array();
  }
  if ($teaser && variable_get('addthis_display_in_teasers', '0') == FALSE) {
    return array();
  }
  if (!$teaser && variable_get('addthis_display_in_links', '0') == FALSE) {
    return array();
  }
  $addthis_node_types = variable_get('addthis_node_types', array());
  if (empty($addthis_node_types[$node->type])) {
    return array();
  }
  $addthis_widget_type = variable_get('addthis_widget_type', 'addthis_button');
  $links = array();
  $links['addthis'] = array(
    'title' => theme($addthis_widget_type, NULL, array(
      'url' => url('node/' . $node->nid, array(
        'absolute' => TRUE,
      )),
      'title' => $node->title,
    )),
    'html' => TRUE,
  );
  return $links;
}