You are here

function monolog_handler_form_submit in Monolog 7

Same name and namespace in other branches
  1. 6 monolog.admin.inc \monolog_handler_form_submit()

Form submission handler for monolog_handler_form().

1 string reference to 'monolog_handler_form_submit'
monolog_handler_form in ./monolog.admin.inc
Handler settings callback.

File

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

Code

function monolog_handler_form_submit($form, &$form_state) {
  $profile = $form['#monolog']['profile'];
  form_state_values_clean($form_state);
  $name = $form_state['values']['name'];
  unset($form_state['values']['name']);
  $profile->options['handlers'][$name] = $form_state['values'] += array(
    'handler' => $form['#monolog']['handler_name'],
  );
  try {
    if (!monolog_profile_save($profile)) {
      throw new \RuntimeException(t('Error saving handler.'));
    }
    $form_state['redirect'] = 'admin/config/development/monolog/profile/' . $profile->name;
    drupal_set_message(t('The configuration options have been saved.'));
  } catch (Exception $e) {
    form_set_error(NULL, $e
      ->getMessage());
    watchdog_exception('monolog', $e);
  }
}