You are here

function janrain_capture_node_view in Janrain Registration 7.4

Same name and namespace in other branches
  1. 7.2 janrain_capture.module \janrain_capture_node_view()
  2. 7.3 janrain_capture.module \janrain_capture_node_view()

Implements hook_node_view().

Attaches the "share" button.

File

./janrain_capture.module, line 1000
This module implements authentication endpoints for Janrain Capture.

Code

function janrain_capture_node_view($node, $view_mode, $langcode) {
  $janrain_share_settings = variable_get('janrain_capture_share', array());
  if (!isset($janrain_share_settings['enabled']) || !$janrain_share_settings['enabled']) {
    return;
  }

  // Should we attach to teasers?
  if ($view_mode == 'teaser' && !variable_get('janrain_capture_share_teasers_' . $node->type, FALSE)) {
    return;
  }

  // Attach to node links section.
  if (variable_get('janrain_capture_share_nodelink_' . $node->type, FALSE)) {
    $node->content['links']['#links']['janrain_capture_share_button'] = array(
      'title' => _janrain_capture_share_button($node),
      'html' => TRUE,
    );
  }

  // Attach to node contents section.
  if (variable_get('janrain_capture_share_nodecont_' . $node->type, FALSE)) {
    $node->content['janrain_capture_share_button'] = array(
      '#markup' => _janrain_capture_share_button($node),
      '#weight' => variable_get('janrain_capture_share_weight_' . $node->type, 40),
    );
  }
}