You are here

function glossify_admin_settings_submit in Glossify 6

Same name and namespace in other branches
  1. 6.3 glossify.admin.inc \glossify_admin_settings_submit()

Form evaluation of administrative settings.

1 string reference to 'glossify_admin_settings_submit'
glossify_admin_settings in ./glossify.admin.inc
Form builder for administrative settings.

File

./glossify.admin.inc, line 246
Glossify Administration

Code

function glossify_admin_settings_submit($form, &$form_state) {
  $configurations = variable_get('glossify_configurations', array());
  $goto = '/admin/settings/glossify';
  if ($form_state['clicked_button']['#value'] == t('Delete configuration') && $form_state['values']['config_id'] !== 'global') {
    unset($configurations[$form_state['values']['name']]);
  }
  else {
    $methods = array(
      'use_title' => $form_state['values']['use_title'],
      'use_internal' => $form_state['values']['use_internal'],
      'use_cck' => $form_state['values']['use_cck'],
      'keyword_field' => $form_state['values']['keyword_field'],
      'override_field' => $form_state['values']['override_field'],
      'use_taxonomy' => $form_state['values']['use_taxonomy'],
      'vocabulary' => $form_state['values']['vocabulary'],
    );
    $configuration = array(
      'from' => $form_state['values']['from'],
      'to' => $form_state['values']['to'],
      'only_first' => $form_state['values']['only_first'],
      'unicode' => $form_state['values']['unicode'],
      'teaser' => $form_state['values']['teaser'],
      'style' => $form_state['values']['style'],
      'break' => $form_state['values']['break'],
      'language' => $form_state['values']['language'],
      'methods' => $methods,
    );
    $name = empty($form_state['values']['name']) ? 'global' : $form_state['values']['name'];
    $configurations[$name] = $configuration;
    $goto .= "/{$name}";
  }
  variable_set('glossify_configurations', $configurations);
  menu_rebuild();
  cache_clear_all('*', 'cache_filter', TRUE);
  drupal_goto($goto);
}