#55351, re-use system settings form, patch by Zen.

less code++
4.7.x
Gerhard Killesreiter 2006-03-23 09:29:35 +00:00
parent 26612e9cbd
commit 6ca5a9a2f5
2 changed files with 4 additions and 42 deletions

View File

@ -289,27 +289,8 @@ function contact_admin_settings() {
$form['reset'] = array('#type' => 'submit',
'#value' => t('Reset to defaults'),
);
return drupal_get_form('contact_admin_settings', $form);
}
/**
* Process settings form submission.
*/
function contact_admin_settings_submit($form_id, $form_values) {
$op = isset($_POST['op']) ? $_POST['op'] : '';
if ($op == t('Reset to defaults')) {
foreach ($form_values as $key => $value) {
variable_del($key);
}
drupal_set_message(t('The configuration options have been reset to their default values.'));
}
else {
foreach ($form_values as $key => $value) {
variable_set($key, $value);
}
drupal_set_message(t('The configuration options have been saved.'));
}
// Use system_settings_form for the callback.
return drupal_get_form('contact_admin_settings', $form, 'system_settings_form');
}
/**

View File

@ -289,27 +289,8 @@ function contact_admin_settings() {
$form['reset'] = array('#type' => 'submit',
'#value' => t('Reset to defaults'),
);
return drupal_get_form('contact_admin_settings', $form);
}
/**
* Process settings form submission.
*/
function contact_admin_settings_submit($form_id, $form_values) {
$op = isset($_POST['op']) ? $_POST['op'] : '';
if ($op == t('Reset to defaults')) {
foreach ($form_values as $key => $value) {
variable_del($key);
}
drupal_set_message(t('The configuration options have been reset to their default values.'));
}
else {
foreach ($form_values as $key => $value) {
variable_set($key, $value);
}
drupal_set_message(t('The configuration options have been saved.'));
}
// Use system_settings_form for the callback.
return drupal_get_form('contact_admin_settings', $form, 'system_settings_form');
}
/**