function cookiebot_settings_form_validate in Cookiebot - Cookie consent, Cookie monitoring and Cookie control 7
Form validate callback for the admin settings form.
Parameters
array $form: The structure of the form.
array $form_state: The current state of the form.
File
- ./
cookiebot.admin.inc, line 166 - Admin functionality for Cookiebot.
Code
function cookiebot_settings_form_validate($form, &$form_state) {
$cbid_trimmed = trim($form_state['values']['cookiebot_cbid']);
$form_state['values']['cookiebot_cbid'] = $cbid_trimmed;
if (!empty($cbid_trimmed) && !preg_match('/^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$/', $cbid_trimmed)) {
form_set_error('cookiebot_cbid', t('The entered Domain Group ID is not formatted correctly.'));
}
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.'));
}
// Clear caches like the system_performance_settings() form does.
drupal_clear_css_cache();
drupal_clear_js_cache();
cache_clear_all('*', 'cache_page', TRUE);
}