You are here

function cdn_admin_other_settings_form_validate in CDN 6.2

Same name and namespace in other branches
  1. 7.2 cdn.admin.inc \cdn_admin_other_settings_form_validate()

Default validate callback for the other settings form.

File

./cdn.admin.inc, line 490
Settings administration UI.

Code

function cdn_admin_other_settings_form_validate($form, &$form_state) {
  if (!empty($form_state['values'][CDN_PICK_SERVER_PHP_CODE_VARIABLE])) {
    $php_code = $form_state['values'][CDN_PICK_SERVER_PHP_CODE_VARIABLE];
    $servers = array();
    if (_cdn_eval_pick_server($php_code, $servers) === FALSE) {
      form_error($form['cdn_pick_server'][CDN_PICK_SERVER_PHP_CODE_VARIABLE], t('Your <code>cdn_pick_server()</code> cannot be evaluated. Please correct it or leave it empty.'));
    }
  }

  // Remove the non-variable.
  unset($form_state['values']['cdn_hook_blacklist']);
}