You are here

function _fb_social_comments_nodeapi_view in Facebook social plugins integration 6.2

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

nodeapi_view callback for this plugin

1 string reference to '_fb_social_comments_nodeapi_view'
comments.inc in plugins/fb_plugin/comments.inc

File

plugins/fb_plugin/comments.inc, line 182

Code

function _fb_social_comments_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;
  }

  // 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;
  }
  $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_comments_' . $preset->name) : 20;
  $node->content['fb_social_comments_' . $preset->name] = array(
    '#weight' => $weight,
    '#value' => $output,
  );
}