You are here

function tweetbutton_nodeapi in Tweet Button 6

Implementation of hook_nodeapi()

File

./tweetbutton.module, line 72

Code

function tweetbutton_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  if ($a3) {
    $node_location = 'teaser';
  }
  else {
    $node_location = 'full';
  }
  $locations = variable_get('tweetbutton_node_location', array(
    'full',
  ));

  // Do not display tweetbutton in node content if its set in node links
  if (in_array($node->type, variable_get('tweetbutton_node_types', array(
    'story',
  )), TRUE) && !empty($locations[$node_location]) && user_access('access tweetbutton') && tweetbutton_allowed_path() && $op == 'view') {
    $weight = module_exists('content') ? content_extra_field_weight($node->type, 'tweetbutton_widget') : variable_get('tweetbutton_node_weight', -5);
    $node->content['tweetbutton'] = array(
      '#value' => theme('tweetbutton_display', $node),
      '#weight' => $weight,
    );
  }
}