Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
301
Merge Requests
301
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
44740785
Commit
44740785
authored
Jul 16, 2009
by
Dries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Patch
#518750
by Damien Tournoud: rethink system settings form.
parent
436fc4f8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
70 deletions
+30
-70
modules/color/color.module
modules/color/color.module
+1
-2
modules/node/content_types.inc
modules/node/content_types.inc
+6
-26
modules/system/system.admin.inc
modules/system/system.admin.inc
+4
-14
modules/system/system.module
modules/system/system.module
+5
-15
modules/system/system.test
modules/system/system.test
+8
-3
modules/update/update.settings.inc
modules/update/update.settings.inc
+6
-10
No files found.
modules/color/color.module
View file @
44740785
...
...
@@ -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'
);
...
...
modules/node/content_types.inc
View file @
44740785
...
...
@@ -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
));
}
...
...
modules/system/system.admin.inc
View file @
44740785
...
...
@@ -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
();
}
...
...
modules/system/system.module
View file @
44740785
...
...
@@ -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
();
}
...
...
modules/system/system.test
View file @
44740785
...
...
@@ -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.'
));
...
...
modules/update/update.settings.inc
View file @
44740785
...
...
@@ -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
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment