You are here

function key_provider_file_validate_configuration_form in Key 7.3

Validate callback for the configuration form.

1 string reference to 'key_provider_file_validate_configuration_form'
file.inc in plugins/key_provider/file.inc

File

plugins/key_provider/file.inc, line 77

Code

function key_provider_file_validate_configuration_form($form, &$form_state) {
  $key_provider_settings = $form_state['values'];
  $file = $key_provider_settings['file_location'];

  // Does the file exist?
  if (!is_file($file)) {
    form_set_error('file_location', t('There is no file at the specified location.'));
    return;
  }

  // Is the file readable?
  if (!is_readable($file)) {
    form_set_error('file_location', t('The file at the specified location is not readable.'));
    return;
  }
}