You are here

function eu_cookie_compliance_update_7019 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_7019()

Add config variables for cookie values.

File

./eu_cookie_compliance.install, line 746
Installation file.

Code

function eu_cookie_compliance_update_7019() {
  $eu_cookie_settings = variable_get('eu_cookie_compliance', array());
  $new_settings = array(
    'cookie_value_disagreed' => '0',
    'cookie_value_agreed_show_thank_you' => '1',
    'cookie_value_agreed' => '2',
  );
  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);
      }
    }
  }

  // Set configuration variables for all domains.
  if (module_exists('domain_settings') && module_exists('domain_conf')) {
    $domains = domain_domains();
    foreach ($domains as $domain_data) {
      $domain_id = $domain_data['domain_id'];
      $settings = domain_conf_variable_get($domain_id, 'eu_cookie_compliance');
      $updated_settings = $settings + $new_settings;
      domain_conf_variable_save($domain_id, 'eu_cookie_compliance', $updated_settings);
    }
  }
}