From 6ca5a9a2f5c1a59aeb9c438c20ac6ea9c247e62a Mon Sep 17 00:00:00 2001 From: Gerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org> Date: Thu, 23 Mar 2006 09:29:35 +0000 Subject: [PATCH] #55351, re-use system settings form, patch by Zen. less code++ --- modules/contact.module | 23 ++--------------------- modules/contact/contact.module | 23 ++--------------------- 2 files changed, 4 insertions(+), 42 deletions(-) diff --git a/modules/contact.module b/modules/contact.module index f05f25419789..da34b83e00de 100644 --- a/modules/contact.module +++ b/modules/contact.module @@ -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'); } /** diff --git a/modules/contact/contact.module b/modules/contact/contact.module index f05f25419789..da34b83e00de 100644 --- a/modules/contact/contact.module +++ b/modules/contact/contact.module @@ -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'); } /** -- GitLab