function addtoany_node_view in AddToAny Share Buttons 7.4
Same name and namespace in other branches
- 5.0 addtoany.module \addtoany_node_view()
- 7 addtoany.module \addtoany_node_view()
- 7.3 addtoany.module \addtoany_node_view()
Implements hook_node_view().
File
- ./
addtoany.module, line 33 - Stand alone module file to handle AddToAny buttons integration
Code
function addtoany_node_view($node, $view_mode) {
$types = variable_get('addtoany_nodetypes', array(
'page',
'article',
));
$teaser = $view_mode == 'teaser' ? TRUE : FALSE;
$rss = $view_mode == 'rss' ? TRUE : FALSE;
// Display in link section?
$show = !empty($node->type) && in_array($node->type, $types, TRUE) && $node->status == 1 && variable_get('addtoany_display_in_nodelink', '1') != 0 && (!$teaser || $teaser && variable_get('addtoany_display_in_teasers', '1') != 0) && (!$rss || $rss && variable_get('addtoany_display_in_rss', '1') != 0);
if ($show) {
$node->content['links']['#links']['addtoany'] = array(
'title' => addtoany_create_node_buttons($node),
'html' => TRUE,
);
}
// Display in content section?
$show = !empty($node->type) && in_array($node->type, $types, TRUE) && $node->status == 1 && variable_get('addtoany_display_in_nodecont', '0') != 0 && (!$teaser || $teaser && variable_get('addtoany_display_in_teasers', '1') != 0) && (!$rss || $rss && variable_get('addtoany_display_in_rss', '1') != 0);
$weight = variable_get('addtoany_display_weight', 40);
if ($show) {
$node->content['addtoany'] = array(
'#markup' => addtoany_create_node_buttons($node),
'#weight' => $weight,
);
}
}