You are here

function high_contrast_settings_form_submit in High contrast 7

Process high_contrast_settings_form form submissions.

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

File

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

Code

function high_contrast_settings_form_submit($form, &$form_state) {

  // Exclude unnecessary elements before saving.
  form_state_values_clean($form_state);
  $values = $form_state['values'];

  // If the user uploaded a new logo or favicon, save it to a permanent location
  // and use it in place of the default theme-provided file.
  if ($file = $values['high_contrast_logo_upload']) {
    unset($values['high_contrast_logo_upload']);
    $filename = file_unmanaged_copy($file->uri);
    $values['high_contrast_default_logo'] = 0;
    $values['high_contrast_logo_path'] = $filename;
    $values['high_contrast_toggle_logo'] = 1;
  }

  // If the user entered a path relative to the system files directory for
  // a logo or favicon, store a public:// URI so the theme system can handle it.
  if (!empty($values['high_contrast_logo_path'])) {
    $values['high_contrast_logo_path'] = _high_contrast_theme_settings_validate_path($values['high_contrast_logo_path']);
  }
  foreach ($values as $key => $val) {
    variable_set($key, $val);
  }
  drupal_set_message(t('The configuration options have been saved.'));
  cache_clear_all();
}