summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/color/color.module3
-rw-r--r--modules/node/content_types.inc32
-rw-r--r--modules/system/system.admin.inc18
-rw-r--r--modules/system/system.module20
-rw-r--r--modules/system/system.test11
-rw-r--r--modules/update/update.settings.inc16
6 files changed, 30 insertions, 70 deletions
diff --git a/modules/color/color.module b/modules/color/color.module
index 924099a6a..14410aa50 100644
--- a/modules/color/color.module
+++ b/modules/color/color.module
@@ -293,8 +293,7 @@ function color_scheme_form_submit($form, &$form_state) {
}
// Don't render the default colorscheme, use the standard theme instead.
- if (implode(',', color_get_palette($theme, TRUE)) == implode(',', $palette)
- || $form_state['values']['op'] == t('Reset to defaults')) {
+ if (implode(',', color_get_palette($theme, TRUE)) == implode(',', $palette)) {
variable_del('color_' . $theme . '_palette');
variable_del('color_' . $theme . '_stylesheets');
variable_del('color_' . $theme . '_logo');
diff --git a/modules/node/content_types.inc b/modules/node/content_types.inc
index b1f5c0686..934ef0dd8 100644
--- a/modules/node/content_types.inc
+++ b/modules/node/content_types.inc
@@ -229,13 +229,6 @@ function node_type_form(&$form_state, $type = NULL) {
);
}
}
- else {
- $form['reset'] = array(
- '#type' => 'submit',
- '#value' => t('Reset to defaults'),
- '#weight' => 50,
- );
- }
return $form;
}
@@ -310,10 +303,7 @@ function node_type_form_submit($form, &$form_state) {
$type->modified = TRUE;
$type->locked = $form_state['values']['locked'];
- if ($op == t('Reset to defaults')) {
- node_type_reset($type);
- }
- elseif ($op == t('Delete content type')) {
+ if ($op == t('Delete content type')) {
$form_state['redirect'] = 'admin/build/node-type/' . str_replace('_', '-', $type->old_type) . '/delete';
return;
}
@@ -337,29 +327,19 @@ function node_type_form_submit($form, &$form_state) {
$variable_new = $key . '_' . $type->type;
$variable_old = $key . '_' . $type->old_type;
- if ($op == t('Reset to defaults')) {
- variable_del($variable_old);
+ if (is_array($value)) {
+ $value = array_keys(array_filter($value));
}
- else {
- if (is_array($value)) {
- $value = array_keys(array_filter($value));
- }
- variable_set($variable_new, $value);
+ variable_set($variable_new, $value);
- if ($variable_new != $variable_old) {
- variable_del($variable_old);
- }
+ if ($variable_new != $variable_old) {
+ variable_del($variable_old);
}
}
node_types_rebuild();
$t_args = array('%name' => $type->name);
- if ($op == t('Reset to defaults')) {
- drupal_set_message(t('The content type %name has been reset to its default values.', $t_args));
- return;
- }
-
if ($status == SAVED_UPDATED) {
drupal_set_message(t('The content type %name has been updated.', $t_args));
}
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index 4bb1129bd..6ac8d2fe8 100644
--- a/modules/system/system.admin.inc
+++ b/modules/system/system.admin.inc
@@ -227,10 +227,6 @@ function system_themes_form() {
'#type' => 'submit',
'#value' => t('Save configuration'),
);
- $form['buttons']['reset'] = array(
- '#type' => 'submit',
- '#value' => t('Reset to defaults'),
- );
return $form;
}
@@ -513,16 +509,10 @@ function system_theme_settings_submit($form, &$form_state) {
$values = $form_state['values'];
$key = $values['var'];
- if ($values['op'] == t('Reset to defaults')) {
- variable_del($key);
- drupal_set_message(t('The configuration options have been reset to their default values.'));
- }
- else {
- // Exclude unnecessary elements before saving.
- unset($values['var'], $values['submit'], $values['reset'], $values['form_id'], $values['op'], $values['form_build_id'], $values['form_token']);
- variable_set($key, $values);
- drupal_set_message(t('The configuration options have been saved.'));
- }
+ // Exclude unnecessary elements before saving.
+ unset($values['var'], $values['submit'], $values['reset'], $values['form_id'], $values['op'], $values['form_build_id'], $values['form_token']);
+ variable_set($key, $values);
+ drupal_set_message(t('The configuration options have been saved.'));
cache_clear_all();
}
diff --git a/modules/system/system.module b/modules/system/system.module
index e05e27e5d..ccfce5370 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -2033,7 +2033,6 @@ function _system_settings_form_automatic_defaults($form) {
*/
function system_settings_form($form, $automatic_defaults = TRUE) {
$form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration') );
- $form['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset to defaults') );
if ($automatic_defaults) {
$form = _system_settings_form_automatic_defaults($form);
@@ -2060,23 +2059,14 @@ function system_settings_form_submit($form, &$form_state) {
unset($form_state['values']['submit'], $form_state['values']['reset'], $form_state['values']['form_id'], $form_state['values']['op'], $form_state['values']['form_token'], $form_state['values']['form_build_id']);
foreach ($form_state['values'] as $key => $value) {
- if ($op == t('Reset to defaults')) {
- variable_del($key);
+ if (is_array($value) && isset($form_state['values']['array_filter'])) {
+ $value = array_keys(array_filter($value));
}
- else {
- if (is_array($value) && isset($form_state['values']['array_filter'])) {
- $value = array_keys(array_filter($value));
- }
- variable_set($key, $value);
- }
- }
- if ($op == t('Reset to defaults')) {
- drupal_set_message(t('The configuration options have been reset to their default values.'));
- }
- else {
- drupal_set_message(t('The configuration options have been saved.'));
+ variable_set($key, $value);
}
+ drupal_set_message(t('The configuration options have been saved.'));
+
cache_clear_all();
drupal_theme_rebuild();
}
diff --git a/modules/system/system.test b/modules/system/system.test
index 78f5634a7..4d40465ef 100644
--- a/modules/system/system.test
+++ b/modules/system/system.test
@@ -539,7 +539,7 @@ class AccessDeniedTestCase extends DrupalWebTestCase {
// Log back in and remove the custom 403 page.
$this->drupalLogin($this->admin_user);
- $this->drupalPost('admin/settings/site-information', array(), t('Reset to defaults'));
+ $this->drupalPost('admin/settings/site-information', array('site_403' => ''), t('Save configuration'));
// Logout and check that the user login block is shown on default 403 pages.
$this->drupalLogout();
@@ -600,7 +600,7 @@ class PageNotFoundTestCase extends DrupalWebTestCase {
// Log back in and remove the custom 404 page.
$this->drupalLogin($this->admin_user);
- $this->drupalPost('admin/settings/site-information', array(), t('Reset to defaults'));
+ $this->drupalPost('admin/settings/site-information', array('site_404' => ''), t('Save configuration'));
// Logout and check that the user login block is not shown on default 404 pages.
$this->drupalLogout();
@@ -961,7 +961,12 @@ class SystemThemeFunctionalTest extends DrupalWebTestCase {
$this->assertRaw('themes/stark', t('Site default theme used on the add content page.'));
// Reset to the default theme settings.
- $this->drupalPost('admin/build/themes', array(), t('Reset to defaults'));
+ $edit = array(
+ 'theme_default' => 'garland',
+ 'admin_theme' => '0',
+ 'node_admin_theme' => FALSE,
+ );
+ $this->drupalPost('admin/build/themes', $edit, t('Save configuration'));
$this->drupalGet('admin');
$this->assertRaw('themes/garland', t('Site default theme used on administration page.'));
diff --git a/modules/update/update.settings.inc b/modules/update/update.settings.inc
index e67f6ba7f..3bb05a38f 100644
--- a/modules/update/update.settings.inc
+++ b/modules/update/update.settings.inc
@@ -91,18 +91,14 @@ function update_settings_validate($form, &$form_state) {
function update_settings_submit($form, $form_state) {
$op = $form_state['values']['op'];
- if ($op == t('Reset to defaults')) {
- unset($form_state['notify_emails']);
+ if (empty($form_state['notify_emails'])) {
+ variable_del('update_notify_emails');
}
else {
- if (empty($form_state['notify_emails'])) {
- variable_del('update_notify_emails');
- }
- else {
- variable_set('update_notify_emails', $form_state['notify_emails']);
- }
- unset($form_state['notify_emails']);
- unset($form_state['values']['update_notify_emails']);
+ variable_set('update_notify_emails', $form_state['notify_emails']);
}
+ unset($form_state['notify_emails']);
+ unset($form_state['values']['update_notify_emails']);
+
system_settings_form_submit($form, $form_state);
}