You are here

function swftools_admin_form_submit in SWF Tools 6

Same name and namespace in other branches
  1. 6.2 swftools.module \swftools_admin_form_submit()
4 string references to 'swftools_admin_form_submit'
flowplayer_admin_form in flowplayer/flowplayer.admin.inc
imagerotator_admin_form in imagerotator/imagerotator.admin.inc
wijering4_admin_form in wijering4/wijering4.admin.inc
wijering_admin_form in wijering/wijering.admin.inc

File

./swftools.module, line 1357

Code

function swftools_admin_form_submit($form, &$form_state) {
  $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';

  // Flatten settings for saving
  $saved = array();
  foreach ($form_state['values'] as $player => $settings) {
    if ($op == t('Reset to defaults')) {
      variable_del('swftools_' . $player);
    }
    else {
      $flat[$player] = array();
      if (is_array($settings)) {
        foreach ($settings as $category => $vars) {
          $flat[$player] = array_merge($flat[$player], $vars);
        }
        variable_set('swftools_' . $player, $flat[$player]);
      }
    }
  }

  // Confirmation message
  if ($op == t('Reset to defaults')) {
    drupal_set_message(t('The configuration options have been reset to their default values.'));
  }
  else {
    drupal_set_message(t('The configuration options have been saved.'));
  }

  // Clear caches
  drupal_flush_all_caches();
}