You are here

function monolog_handler_delete_form_submit in Monolog 6

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

Form submission handler for monolog_handler_delete_form().

File

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

Code

function monolog_handler_delete_form_submit($form, &$form_state) {
  if ($form_state['values']['confirm']) {
    $profile = $form['#monolog']['profile'];
    $handler = $form['#monolog']['handler'];
    $name = $form['#monolog']['handler_name'];
    unset($profile->options['handlers'][$name]);
    $args = array(
      '%label' => $handler['label'],
    );
    if (monolog_profile_save($profile)) {
      drupal_set_message(t('The %label handler has been removed.', $args));
    }
    else {
      drupal_set_message(t('Error removing the %label handler.', $args), 'error');
    }
  }
  $form_state['redirect'] = 'admin/config/development/monolog/profile/' . $profile->name;
}