You are here

function eu_cookie_compliance_update_7012 in EU Cookie Compliance (GDPR Compliance) 7

Same name and namespace in other branches
  1. 7.2 eu_cookie_compliance.install \eu_cookie_compliance_update_7012()

Add config variables for the "Opt-in with categories" feature.

File

./eu_cookie_compliance.install, line 493
Installation file.

Code

function eu_cookie_compliance_update_7012() {
  $eu_cookie_settings = variable_get('eu_cookie_compliance', array());
  $new_settings = array(
    'cookie_categories' => '',
    'enable_save_preferences_button' => TRUE,
    'save_preferences_button_label' => 'Save preferences',
    'accept_all_categories_button_label' => 'Accept all cookies',
    'fix_first_cookie_category' => TRUE,
    'select_all_categories_by_default' => FALSE,
    'withdraw_button_on_info_popup' => FALSE,
  );
  variable_set('eu_cookie_compliance', $eu_cookie_settings + $new_settings);
  if (module_exists('i18n_variable')) {
    $languages = language_list();
    foreach (array_keys($languages) as $langcode) {
      $settings = i18n_variable_get('eu_cookie_compliance', $langcode);
      if (!empty($settings)) {
        $updated_setting = $settings + $new_settings;
        variable_realm_set('language', $langcode, 'eu_cookie_compliance', $updated_setting, FALSE);
      }
    }
  }
}