You are here

function varnish_admin_settings_form_validate in Varnish 7

Same name and namespace in other branches
  1. 6 varnish.admin.inc \varnish_admin_settings_form_validate()

Validator for the varnish admin settings form.

File

./varnish.admin.inc, line 155
Administrative functions for Varnish integration.

Code

function varnish_admin_settings_form_validate($form, &$form_state) {
  if (!is_numeric($form_state['values']['varnish_socket_timeout']) || $form_state['values']['varnish_socket_timeout'] < 0) {
    form_set_error('varnish_socket_timeout', t('Varnish connection timeout must be a positive number.'));
  }
  else {
    $form_state['values']['varnish_socket_timeout'] = (int) $form_state['values']['varnish_socket_timeout'];
  }
}