You are here

function sharethis_link in ShareThis 5

Same name and namespace in other branches
  1. 6 sharethis.module \sharethis_link()

Implementation of hook_link().

File

./sharethis.module, line 139
Provides the ShareThis service.

Code

function sharethis_link($type, $node = NULL, $teaser = FALSE) {
  if (!$teaser || variable_get('sharethis_teaser', 1)) {
    if (variable_get('sharethis_sharethis_this_where', 'links') == 'links') {
      if (_sharethis_sharethis_this_show($node->type, $node->nid) && user_access('use share this')) {
        if (sharethis_add_js()) {
          $sharethis = sharethis_get_js($node->title, url('node/' . $node->nid, NULL, NULL, TRUE));
          $links['sharethis_sharethis_this'] = array(
            'title' => $sharethis,
            'html' => TRUE,
            'attributes' => array(
              'id' => 'sharethis_' . $node->nid,
            ),
          );
          return $links;
        }
      }
    }
  }
}