You are here

function high_contrast_settings_form_validate in High contrast 7

Validator for the system_theme_settings() form.

1 string reference to 'high_contrast_settings_form_validate'
high_contrast_settings_form in ./high_contrast.module
Settings form.

File

./high_contrast.module, line 237
High Contrast main module file.

Code

function high_contrast_settings_form_validate($form, &$form_state) {

  // Handle file uploads.
  $validators = [
    'file_validate_is_image' => [],
  ];

  // Check for a new uploaded logo.
  $file = file_save_upload('high_contrast_logo_upload', $validators);
  if (isset($file)) {

    // File upload was attempted.
    if ($file) {

      // Put the temporary file in form_values so we can save it on submit.
      $form_state['values']['high_contrast_logo_upload'] = $file;
    }
    else {

      // File upload failed.
      form_set_error('high_contrast_logo_upload', t('The logo could not be uploaded.'));
    }
  }
}