You are here

function textimage_form_settings_submit in Textimage 7.3

Textimage settings form - submission.

File

./textimage.admin.inc, line 247
Textimage - Admin page callbacks.

Code

function textimage_form_settings_submit($form, &$form_state) {
  if ($form_state['triggering_element']['#name'] == 'flush_all') {

    // Redirect to cleanup.
    $form_state['redirect'] = 'admin/config/media/textimage/cleanup';
    return;
  }
  $v = $form_state['values'];
  if ($v['store_scheme'] != _textimage_get_variable('store_scheme')) {
    _textimage_flush_all();
    _textimage_set_variable('store_scheme', $v['store_scheme']);
  }
  _textimage_set_variable('fonts_handling_module', $v['fonts_handling_module']);
  _textimage_set_variable('fonts_path', $v['fonts_path']);
  $options = array();
  if ($v['fonts_handling_module'] == 'textimage') {
    $options['fonts_path'] = $v['fonts_path'];
  }
  $font_uri = TextimageFonts::getUri($v['default_font_name'], $v['fonts_handling_module'], $options);
  _textimage_set_variable('default_font', array(
    'name' => $v['default_font_name'],
    'uri' => $font_uri,
  ));
  _textimage_set_variable('backgrounds_handling_module', $v['backgrounds_handling_module']);
  _textimage_set_variable('backgrounds_path', $v['backgrounds_path']);
  _textimage_set_variable('color_selector', $v['color_selector']);
  drupal_set_message(t('The configuration options have been saved.'), 'status');
}