You are here

function cookiebot_page_alter in Cookiebot - Cookie consent, Cookie monitoring and Cookie control 7

Implements hook_page_alter().

File

./cookiebot.module, line 91
The Cookiebot main module file.

Code

function cookiebot_page_alter(&$page) {
  if (!_cookiebot_visible()) {
    return;
  }
  $cookiebot_message_placeholder_cookieconsent_optout_marketing = variable_get('cookiebot_message_placeholder_cookieconsent_optout_marketing', [
    'value' => '',
    'format' => filter_default_format(),
  ]);
  $message_placeholder_cookieconsent_optout_marketing_build = [
    '#theme' => 'cookiebot_blocked_element_placeholder',
    '#content' => check_markup($cookiebot_message_placeholder_cookieconsent_optout_marketing['value'], $cookiebot_message_placeholder_cookieconsent_optout_marketing['format']),
  ];
  drupal_add_js([
    'cookiebot' => [
      'message_placeholder_cookieconsent_optout_marketing_show' => variable_get('cookiebot_message_placeholder_cookieconsent_optout_marketing_show') ? TRUE : FALSE,
      'message_placeholder_cookieconsent_optout_marketing' => drupal_render($message_placeholder_cookieconsent_optout_marketing_build),
    ],
  ], 'setting');
  drupal_add_js(drupal_get_path('module', 'cookiebot') . '/js/cookiebot.js');
  drupal_add_css(drupal_get_path('module', 'cookiebot') . '/css/cookiebot.css', [
    'every_page' => TRUE,
  ]);
}