function google_plusone_node_view in Google Plus One Button | Google+ Badge 7
Implements hook_node_view().
File
- ./
google_plusone.module, line 72
Code
function google_plusone_node_view($node, $view_mode) {
$node_types = variable_get('google_plusone_node_types', array());
if (!empty($node_types[$node->type]) && user_access('view google plusone')) {
$locations = variable_get('google_plusone_node_location', array(
'full',
));
$default = array(
'annotation' => 'bubble',
'width' => '250',
'size' => '',
// standard
'css' => 'margin: 0 1em 1em 1em;float:right',
'syntax' => 'g:plusone',
'alias' => 'aliased',
);
$button_settings = array_merge($default, variable_get('google_plusone_button_settings', array()));
$button_settings['node'] = $node;
if (!empty($locations[$view_mode]) && empty($locations['link'])) {
$node->content['google_plusone'] = array(
'#markup' => theme('google_plusone_button__' . $node->type, $button_settings),
'#weight' => variable_get('google_plusone_weight', -10),
);
}
if (!empty($locations[$view_mode]) && !empty($locations['link'])) {
$node->content['links']['#links']['node_google_plusone_link'] = array(
'title' => theme('google_plusone_button__' . $node->type, $button_settings),
'html' => TRUE,
);
}
}
}