Skip to content
Snippets Groups Projects

Change CDN location

3 files
+ 30
5
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 15
0
@@ -21,6 +21,9 @@
@@ -21,6 +21,9 @@
function cookiebot_settings_form($form, &$form_state) {
function cookiebot_settings_form($form, &$form_state) {
$cbid = variable_get('cookiebot_cbid', '');
$cbid = variable_get('cookiebot_cbid', '');
 
$cdn_location_select_value = array('0' => t('Choose a CDN location'));
 
$cdn_locations = array_merge($cdn_location_select_value, variable_get('cookiebot_valid_cdn_locations'));
 
if (empty($cbid)) {
if (empty($cbid)) {
drupal_set_message(t('Cookiebot functionality is disabled until you enter a valid CBID.'), 'warning');
drupal_set_message(t('Cookiebot functionality is disabled until you enter a valid CBID.'), 'warning');
}
}
@@ -32,6 +35,13 @@ function cookiebot_settings_form($form, &$form_state) {
@@ -32,6 +35,13 @@ function cookiebot_settings_form($form, &$form_state) {
'#default_value' => $cbid,
'#default_value' => $cbid,
);
);
 
$form['cookiebot_cdn_location'] = array(
 
'#type' => 'select',
 
'#options' => $cdn_locations,
 
'#default_value' => variable_get('cookiebot_cdn_location', '0'),
 
'#description' => t('We offer a strictly European based version of the Cookiebot CMP for our European customers.')
 
);
 
$form['cookiebot_block_cookies'] = [
$form['cookiebot_block_cookies'] = [
'#type' => 'checkbox',
'#type' => 'checkbox',
'#title' => t('Automatically block all cookies'),
'#title' => t('Automatically block all cookies'),
@@ -171,6 +181,11 @@ function cookiebot_settings_form_validate($form, &$form_state) {
@@ -171,6 +181,11 @@ function cookiebot_settings_form_validate($form, &$form_state) {
form_set_error('cookiebot_cbid', t('The entered Domain Group ID is not formatted correctly.'));
form_set_error('cookiebot_cbid', t('The entered Domain Group ID is not formatted correctly.'));
}
}
 
 
if ($form_state['values']['cookiebot_cdn_location'] === '0') {
 
form_set_error('cookiebot_cdn_location', t('The chosen CDN location is not valid.'));
 
}
 
if (!empty($form_state['values']['cookiebot_show_declaration_node_id']) && !node_load($form_state['values']['cookiebot_show_declaration_node_id'])) {
if (!empty($form_state['values']['cookiebot_show_declaration_node_id']) && !node_load($form_state['values']['cookiebot_show_declaration_node_id'])) {
form_set_error('cookiebot_show_declaration_node_id', t('The entered node ID is invalid.'));
form_set_error('cookiebot_show_declaration_node_id', t('The entered node ID is invalid.'));
}
}
Loading