function basic_cart_node_view in Basic cart 7
Same name and namespace in other branches
- 7.2 basic_cart.module \basic_cart_node_view()
Implements hook_node_view().
File
- ./
basic_cart.module, line 104 - Basic cart module file.
Code
function basic_cart_node_view($node, $view_mode, $langcode) {
// Check if the current user has access.
if (user_access('use basic cart')) {
// Getting node types.
$node_types = variable_get('basic_cart_content_types');
if (!is_array($node_types) || empty($node_types)) {
return;
}
if (!empty($node_types[$node->type]) && in_array($node->type, $node_types)) {
$node->content['basic_cart_add_to_cart'] = array(
'#markup' => theme('basic_cart_add_to_cart', array(
'nid' => $node->nid,
)),
'#weight' => 50,
);
}
}
}