You are here

function google_plusone_link in Google Plus One Button | Google+ Badge 6

Implements hook_link(). Add a button tag to the link section of the node (teaser or full node).

File

./google_plusone.module, line 92

Code

function google_plusone_link($type, $node = NULL, $teaser = FALSE) {
  $links = array();
  $view_mode = $teaser ? 'teaser' : 'full';
  $locations = variable_get('google_plusone_node_location', array(
    'full',
  ));
  $node_types = variable_get('google_plusone_node_types', array());
  if ($type === 'node' && !empty($locations['link']) && !empty($locations[$view_mode]) && !empty($node_types[$node->type]) && user_access('view google plusone')) {
    $default = array(
      'annotation' => 'bubble',
      'width' => '250',
      'size' => '',
      // standard
      'css' => 'margin: 0 1em 1em 1em;float:right;',
      'syntax' => 'HTML5',
    );
    $button_settings = variable_get('google_plusone_button_settings', $default) + array(
      'node' => $node,
    );
    $links['google_plusone'] = array(
      'title' => theme('google_plusone_button', $button_settings),
      'html' => TRUE,
    );
  }
  return $links;
}