You are here

function monolog_profile_import_form_validate in Monolog 6

Same name and namespace in other branches
  1. 7 monolog.admin.inc \monolog_profile_import_form_validate()

Form validation handler for monolog_profile_import_form().

1 string reference to 'monolog_profile_import_form_validate'
monolog_profile_import_form in ./monolog.admin.inc
Import form for profile configurations.

File

./monolog.admin.inc, line 601
Administrative settings for the Monolog module.

Code

function monolog_profile_import_form_validate($form, &$form_state) {
  $profile = ctools_export_crud_import('monolog_profile', $form_state['values']['import']);
  if (!is_string($profile)) {
    if (!$form_state['values']['overwrite'] && ctools_export_crud_load('monolog_profile', $profile->name)) {
      form_error($form['import'], t('Logging profile @name already exists', array(
        '@name' => $profile->name,
      )));
    }
    else {
      form_set_value($form['profile'], $profile, $form_state);
    }
  }
  else {
    form_error($form['import'], t('Unable to get an import from the code. Errors reported: @errors', array(
      '@errors' => $profile,
    )));
  }
}