You are here

function glossify_admin_settings_validate in Glossify 6.3

Same name and namespace in other branches
  1. 6 glossify.admin.inc \glossify_admin_settings_validate()

Form validation of administrative settings.

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

File

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

Code

function glossify_admin_settings_validate($form, &$form_state) {
  if ($form_state['values']['config_id'] == 'add' && empty($form_state['values']['name'])) {
    form_set_error('name', t('You must specify a name for the configuration'));
  }
  else {
    if ($form_state['values']['config_id'] == 'add' && in_array(strtolower($form_state['values']['name']), array_keys(variable_get('glossify_configurations', array())))) {
      form_set_error('name', t('This configuration name is already in use.'));
    }
  }
  if (count($form_state['values']['from']) < 1) {
    form_set_error('from', t('You need to select at least one "FROM" content type'));
  }
  if (count($form_state['values']['to']) < 1) {
    form_set_error('to', t('You need to select at least one "TO" content type'));
  }
  if ($form_state['values']['use_title'] + $form_state['values']['use_internal'] + $form_state['values']['use_cck'] + $form_state['values']['use_taxonomy'] == 0) {
    form_set_error('methods', t('You need to select at least one Method.'));
  }
  if (empty($form_state['values']['style']['hovertip']) && empty($form_state['values']['style']['links']) && empty($form_state['values']['style']['reference'])) {
    form_set_error('styles', t('You need to select at least one Style.'));
  }
}