function monolog_profile_form_submit in Monolog 6
Same name and namespace in other branches
- 7 monolog.admin.inc \monolog_profile_form_submit()
Form submission handler for monolog_profile_form().
1 string reference to 'monolog_profile_form_submit'
- monolog_profile_form in ./
monolog.admin.inc - Form for adding and editing logging profile configurations.
File
- ./
monolog.admin.inc, line 356 - Administrative settings for the Monolog module.
Code
function monolog_profile_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']);
// Add weight and label from the table.
$keys = array(
'level',
'bubble',
'weight',
);
foreach ($keys as $key) {
if (isset($form_state['values']['channel_table'][$key])) {
foreach ($form_state['values']['channel_table'][$key] as $handler_name => $weight) {
$form_state['values']['handlers'][$handler_name][$key] = $weight;
}
}
}
// Removes the raw values passed through the tables.
unset($form_state['values']['channel_table']);
$profile->name = $name;
$profile->options = $form_state['values'];
try {
if (!monolog_profile_save($profile)) {
throw new Exception(t('Error saving logging profile.'));
}
$form_state['redirect'] = 'admin/config/development/monolog/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);
}
}