You are here

function _calendar_setup_form_submit in Calendar 5.2

Same name and namespace in other branches
  1. 5 calendar_admin.inc \_calendar_setup_form_submit()

Save requested values.

1 call to _calendar_setup_form_submit()
calendar_setup_form_submit in ./calendar.module
Save Setup values.

File

./calendar_admin.inc, line 522
This file contains administrative functions used only when setting up the calendar and views_hooks() that are called infrequently and cached. No need to parse all this code the rest of the time.

Code

function _calendar_setup_form_submit($form_id, $form_values) {
  $view_name = $form_values['view_name'];
  $display_format = array();
  variable_set('calendar_empty_arg', check_plain($form_values['calendar_empty_arg']));
  foreach ($form_values as $value_name => $value) {
    switch ($value_name) {
      case 'calendar_year_range':
        variable_set('calendar_year_range_' . $view_name, $value);
        break;
      case 'calendar_limit':
        variable_set('calendar_limit_' . $view_name, $value);
        break;
      case 'calendar_limit_behavior':
        variable_set('calendar_limit_behavior_' . $view_name, $value);
        break;
      case 'calendar_time_format':
        variable_set('calendar_time_format_' . $view_name, $value);
        break;
      case 'calendar_day_header':
        variable_set('calendar_day_header_' . $view_name, $value);
        break;
      case 'calendar_full_day_header':
        variable_set('calendar_full_day_header_' . $view_name, $value);
        break;
      case 'year':
      case 'month':
      case 'week':
      case 'day':
      case 'block':
        $display_format[$value_name] = $value;
        break;
    }
  }
  variable_set('calendar_weekno_' . $view_name, check_plain($form_values['calendar_weekno']));
  variable_set('calendar_popup_' . $view_name, check_plain($form_values['calendar_popup']));
  variable_set('calendar_truncate_length_' . $view_name, check_plain($form_values['calendar_truncate_length']));
  variable_set('calendar_display_format_' . $view_name, $display_format);
  drupal_set_message(t('Calendar settings have been updated.'));
}