function cdn_admin_settings_form_validate in CDN 6
Default validate callback for the settings form.
File
- ./
cdn.admin.inc, line 152 - Settings administration UI.
Code
function cdn_admin_settings_form_validate($form, &$form_state) {
// Validate the synced files DB whenever advanced mode is enabled. It must
// be configured (on the advanced settings form) *before* advanced mode can
// be enabled!
$enabled = isset($form_state['values'][CDN_STATUS_VARIABLE]) && $form_state['values'][CDN_STATUS_VARIABLE] != CDN_DISABLED;
$advanced = isset($form_state['values'][CDN_MODE_VARIABLE]) && $form_state['values'][CDN_MODE_VARIABLE] == CDN_MODE_ADVANCED;
if ($enabled && $advanced) {
$synced_files_db = variable_get(CDN_ADVANCED_SYNCED_FILES_DB_VARIABLE, '');
if (!_validate_synced_files_db($synced_files_db, CDN_STATUS_VARIABLE)) {
drupal_set_message(t('Please correct the above error in the <em>Advanced mode</em> settings form first.'), 'error');
}
}
}