Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
d0818780
Commit
d0818780
authored
Mar 27, 2006
by
Gerhard Killesreiter
Browse files
#55766
, Custom submit handlers get insufficient arguments, patch by Adrian
parent
ca1dbd80
Changes
1
Hide whitespace changes
Inline
Side-by-side
includes/form.inc
View file @
d0818780
...
...
@@ -99,10 +99,10 @@ function drupal_get_form($form_id, &$form, $callback = NULL) {
if
(
function_exists
(
$form_id
.
'_submit'
))
{
// we set submit here so that it can be altered but use reference for
// $form_values because it will change later
$form
[
'#submit'
]
=
array
(
$form_id
.
'_submit'
=>
array
(
$form_id
,
&
$form_values
));
$form
[
'#submit'
]
=
array
(
$form_id
.
'_submit'
=>
array
());
}
elseif
(
function_exists
(
$callback
.
'_submit'
))
{
$form
[
'#submit'
]
=
array
(
$callback
.
'_submit'
=>
array
(
$form_id
,
&
$form_values
));
$form
[
'#submit'
]
=
array
(
$callback
.
'_submit'
=>
array
());
}
}
...
...
@@ -165,12 +165,15 @@ function drupal_validate_form($form_id, &$form, $callback = NULL) {
}
function
drupal_submit_form
(
$form_id
,
$form
,
$callback
=
NULL
)
{
global
$form_values
;
$default_args
=
array
(
$form_id
,
&
$form_values
);
// Prevent system module forms (system/theme settings) from saving certain form fields to the variables table.
unset
(
$GLOBALS
[
'form_values'
][
'submit'
],
$GLOBALS
[
'form_values'
][
'reset'
],
$GLOBALS
[
'form_values'
][
'form_id'
]);
if
(
isset
(
$form
[
'#submit'
]))
{
foreach
(
$form
[
'#submit'
]
as
$function
=>
$args
)
{
if
(
function_exists
(
$function
))
{
$args
=
array_merge
(
$default_args
,
(
array
)
$args
);
// Since we can only redirect to one page, only the last redirect will work
$redirect
=
call_user_func_array
(
$function
,
$args
);
if
(
isset
(
$redirect
))
{
...
...
Write
Preview
Supports
Markdown
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