function cookiebot_node_view_alter in Cookiebot - Cookie consent, Cookie monitoring and Cookie control 7
Same name and namespace in other branches
- 8 cookiebot.module \cookiebot_node_view_alter()
Implements hook_node_view_alter().
File
- ./
cookiebot.module, line 191 - The Cookiebot main module file.
Code
function cookiebot_node_view_alter(&$build) {
$nid = $build['#node']->nid;
$declaration_node_id = variable_get('cookiebot_show_declaration_node_id', '');
$cbid = variable_get('cookiebot_cbid', '');
if ($nid != $declaration_node_id || $build['#view_mode'] !== 'full' || empty($cbid) || !variable_get('cookiebot_show_declaration', FALSE)) {
return;
}
// Print full cookies declaration from Cookiebot.
$build['cookiebot'] = array(
'#theme' => 'cookiebot_declaration',
'#cookiebot_src' => 'https://consent.cookiebot.com/' . $cbid . '/cd.js',
);
}