summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorNeil Drumm <drumm@3064.no-reply.drupal.org>2006-04-02 23:14:51 +0000
committerNeil Drumm <drumm@3064.no-reply.drupal.org>2006-04-02 23:14:51 +0000
commit352fb57d6cd6ced74f78a87c8e40a2d548b15927 (patch)
tree5ff6f7728a1eea957d915bf1682f783984f6cecc /includes
parent1a7a63b0fac6511c89d4b4c1dd058cbb01ac1314 (diff)
downloadbrdo-352fb57d6cd6ced74f78a87c8e40a2d548b15927.tar.gz
brdo-352fb57d6cd6ced74f78a87c8e40a2d548b15927.tar.bz2
#56921 by chx, removing the $form = from $form = form_builder($form_id, $form) then it works.
Diffstat (limited to 'includes')
-rw-r--r--includes/form.inc18
1 files changed, 4 insertions, 14 deletions
diff --git a/includes/form.inc b/includes/form.inc
index e11277391..170cfc35b 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -111,7 +111,8 @@ function drupal_get_form($form_id, &$form, $callback = NULL) {
$function($form_id, $form);
}
- $form = form_builder($form_id, $form);
+ form_builder($form_id, $form);
+
if (!empty($_POST['edit']) && (($_POST['edit']['form_id'] == $form_id) || ($_POST['edit']['form_id'] == $callback))) {
drupal_validate_form($form_id, $form, $callback);
if ($form_submitted && !form_get_errors()) {
@@ -157,15 +158,6 @@ function drupal_get_form($form_id, &$form, $callback = NULL) {
function drupal_validate_form($form_id, &$form, $callback = NULL) {
global $form_values;
- // we need a copy of form_values otherwise foreach falls into an infite loop
- $copy = (array)$form_values;
- // this loop breaks the references in form_values thus makes it impossible for
- // validate functions to modify the $form_values array
- foreach ($copy as $k => $v) {
- unset($form_values[$k]);
- $form_values[$k] = $v;
- }
-
if (isset($form['#token'])) {
if ($form_values['form_token'] != md5(session_id() . $form['#token'] . variable_get('drupal_private_key', ''))) {
// setting this error will cause the form to fail validation
@@ -316,7 +308,7 @@ function form_error(&$element, $message = '') {
* @param $form
* An associative array containing the structure of the form.
*/
-function form_builder($form_id, $form) {
+function form_builder($form_id, &$form) {
global $form_values;
global $form_submitted;
/* Use element defaults */
@@ -425,7 +417,7 @@ function form_builder($form_id, $form) {
if (!isset($form[$key]['#weight'])) {
$form[$key]['#weight'] = $count/1000;
}
- $form[$key] = form_builder($form_id, $form[$key]);
+ form_builder($form_id, $form[$key]);
$count++;
}
@@ -434,8 +426,6 @@ function form_builder($form_id, $form) {
$form = $function($form, $form_values);
$form['#after_build_done'] = TRUE;
}
-
- return $form;
}
/**