You are here

function sharethis_nodeapi in ShareThis 5

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

Implementation of hook_nodeapi().

File

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

Code

function sharethis_nodeapi(&$node, $op, $teaser, $page) {
  switch ($op) {
    case 'view':
      if (!$teaser || variable_get('sharethis_teaser', 1)) {
        if (variable_get('sharethis_sharethis_this_where', 'links') == 'nodes') {
          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));
              $node->content['sharethis_sharethis_this'] = array(
                '#value' => $sharethis,
                '#weight' => variable_get('sharethis_sharethis_weight', 0),
              );
            }
          }
        }
      }
      break;
  }
}