function cookiebot_preprocess_html in Cookiebot - Cookie consent, Cookie monitoring and Cookie control 7
File
- ./
cookiebot.module, line 111 - The Cookiebot main module file.
Code
function cookiebot_preprocess_html(&$variables) {
if (!_cookiebot_visible()) {
return;
}
$cbid = variable_get('cookiebot_cbid', '');
$attributes = [
'id' => 'Cookiebot',
'src' => 'https://consent.cookiebot.com/uc.js',
'data-cbid' => check_plain($cbid),
];
if (variable_get('cookiebot_block_cookies')) {
$attributes['data-blockingmode'] = 'auto';
}
else {
$attributes['async'] = 'async';
}
if (variable_get('cookiebot_iab_enabled')) {
$attributes['data-framework'] = 'IAB';
}
$cookiebot = array(
'#type' => 'markup',
'#markup' => '<script type="text/javascript" ' . drupal_attributes($attributes) . '></script>' . "\n",
'#weight' => -1001,
);
drupal_add_html_head($cookiebot, 'cookiebot_banner');
}