You are here

function weather_admin_main_page_form_submit in Weather 7.3

Same name and namespace in other branches
  1. 7 weather.forms.inc \weather_admin_main_page_form_submit()
  2. 7.2 weather.forms.inc \weather_admin_main_page_form_submit()

Handle the submission for general settings of the Weather module.

File

./weather.forms.inc, line 103
Provide forms for configuration of weather displays.

Code

function weather_admin_main_page_form_submit($form, &$form_state) {
  variable_set('weather_use_webfont', $form_state['values']['weather_use_webfont']);
  $directory = $form_state['values']['weather_image_directory'];

  // Remove whitespace and directory separators from the string.
  $directory = trim(trim($directory, '/\\'));

  // Replace Windows-style directory separators with Unix separators.
  $directory = implode('/', explode('\\', $directory));
  variable_set('weather_image_directory', $directory);
  variable_set('weather_forecast_days', $form_state['values']['weather_forecast_days']);
  drupal_set_message(t('The configuration has been saved.'));
}