You are here

function calendar_systems_calendar_form_submit in Calendar Systems 6.2

Form submission callback for a calendar administration settings form.

File

./calendar_systems.admin.inc, line 211
Implements necessary callbacks for Calendar Systems administration forms.

Code

function calendar_systems_calendar_form_submit($form, &$form_state) {

  // Get the passed calendar information.
  $calendar = $form_state['values']['calendar'];

  // Purging unnecessary configs.
  unset($form_state['values']['op'], $form_state['values']['submit'], $form_state['values']['form_id'], $form_state['values']['calendar'], $form_state['values']['form_token'], $form_state['values']['form_build_id']);

  // Save the rest in a "calendar_systems_settings_{IDENTIFIER}" db variable.
  variable_set('calendar_systems_settings_' . $calendar['identifier'], $form_state['values']);

  // Set a success message and redirect her
  // to the calendar listing page after submission.
  $form_state['redirect'] = 'admin/settings/date-time/calendars';
  drupal_set_message(t('Configuration for <em>@calendar</em> has been successfully saved.', array(
    '@calendar' => calendar_systems_calendar_title($calendar['identifier']),
  )));
}