You are here

function textimage_preset_edit_submit in Textimage 7.2

Same name and namespace in other branches
  1. 5.2 textimage_admin.inc \textimage_preset_edit_submit()
  2. 5 textimage.module \textimage_preset_edit_submit()
  3. 6.2 textimage_admin.inc \textimage_preset_edit_submit()

Todo.

File

./textimage.admin.inc, line 469
Textimage admin page callback

Code

function textimage_preset_edit_submit($form, &$form_state) {
  if (isset($form_state['storage']['validate_error'])) {
    return;
  }
  if (!isset($form_state['values']['pid'])) {
    $return = _textimage_preset_create($form_state['values']['name'], $form_state['values']['description'], $form_state['values']['settings']);
  }
  elseif (is_numeric($form_state['values']['pid'])) {
    $return = _textimage_preset_update($form_state['values']['pid'], $form_state['values']['name'], $form_state['values']['description'], $form_state['values']['settings']);
    if (!$return) {
      drupal_set_message(t('No change in preset values.'), 'warning');
      drupal_goto('admin/config/media/textimage/preset/list');
    }
  }
  if ($return) {
    _textimage_flush_cache();
    drupal_theme_rebuild();
    drupal_set_message(t('Updated preset %name', array(
      '%name' => $form_state['values']['name'],
    )));
    drupal_goto('admin/config/media/textimage/preset/list');
  }
  else {
    drupal_set_message(t('The preset was unable to be updated.'), 'error');
  }
}