You are here

function _fb_social_send_nodeapi_view in Facebook social plugins integration 6.2

Same name and namespace in other branches
  1. 7.2 plugins/fb_plugin/send.inc \_fb_social_send_nodeapi_view()

nodeapi_view callback for this plugin

1 string reference to '_fb_social_send_nodeapi_view'
send.inc in plugins/fb_plugin/send.inc

File

plugins/fb_plugin/send.inc, line 132

Code

function _fb_social_send_nodeapi_view($preset, &$node, $op, $a3 = NULL, $a4 = NULL) {

  // dont disply plugin for unpublished nodes
  if (!$node->status) {
    return;
  }

  // this plugin is not enabled on this content type
  if (!fb_social_preset_node_types($preset, $node->type)) {
    return;
  }

  // or when it's not supposed to be displayed in the node content area
  if (!$preset->settings['plugin_location']['location']) {
    return;
  }

  // we are in a page view but the settings says to display the plugin only in teaser view
  if ($a4 && empty($preset->settings['plugin_location']['node_view_modes']['full'])) {
    return;
  }

  // we are in a page view but the settings says to display the plugin only in teaser view
  if ($a3 && empty($preset->settings['plugin_location']['node_view_modes']['teaser'])) {
    return;
  }

  // all good ...
  $preset->fb_attrs['href'] = fb_social_url('node/' . $node->nid);
  $output = fb_social_preset_view($preset);
  $weight = module_exists('content') ? content_extra_field_weight($node->type, 'fb_social_send_' . $preset->name) : 10;
  $node->content['fb_social_send_' . $preset->name] = array(
    '#weight' => $weight,
    '#value' => $output,
  );
}