diff options
Diffstat (limited to 'includes/form.inc')
-rw-r--r-- | includes/form.inc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/includes/form.inc b/includes/form.inc index e2a3b06ba..7eb461883 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -755,8 +755,11 @@ function form_builder($form_id, $form) { form_set_value($form, $form['#value']); } + // We start off assuming all form elements are in the correct order. + $form['#sorted'] = TRUE; + // Recurse through all child elements. - $count = 0; + $count = 0; foreach (element_children($form) as $key) { $form[$key]['#post'] = $form['#post']; $form[$key]['#programmed'] = $form['#programmed']; @@ -780,6 +783,10 @@ function form_builder($form_id, $form) { if (!isset($form[$key]['#weight'])) { $form[$key]['#weight'] = $count/1000; } + else { + // If one the child elements has a weight then we will need to sort later. + unset($form['#sorted']); + } $form[$key] = form_builder($form_id, $form[$key]); $count++; } |