summaryrefslogtreecommitdiff
path: root/includes/form.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-11-22 07:32:47 +0000
committerDries Buytaert <dries@buytaert.net>2009-11-22 07:32:47 +0000
commit5187fa6f214f1009ce4e70885bd4a0792e28d105 (patch)
tree2b4f7e3a64bac53becb8e591d2639c3e97845380 /includes/form.inc
parent2fad47da011b041af32327da3c04758ee8bdd0a8 (diff)
downloadbrdo-5187fa6f214f1009ce4e70885bd4a0792e28d105.tar.gz
brdo-5187fa6f214f1009ce4e70885bd4a0792e28d105.tar.bz2
- Patch #639418 by sun: #array_parents() do not always map to actual form structure.
Diffstat (limited to 'includes/form.inc')
-rw-r--r--includes/form.inc7
1 files changed, 4 insertions, 3 deletions
diff --git a/includes/form.inc b/includes/form.inc
index 170badbb0..964066a1d 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -1109,10 +1109,11 @@ function form_builder($form_id, $element, &$form_state) {
// Check to see if a tree of child elements is present. If so,
// continue down the tree if required.
$element[$key]['#parents'] = $element[$key]['#tree'] && $element['#tree'] ? array_merge($element['#parents'], array($key)) : array($key);
- $array_parents = isset($element['#array_parents']) ? $element['#array_parents'] : array();
- $array_parents[] = $key;
- $element[$key]['#array_parents'] = $array_parents;
}
+ // Ensure #array_parents follows the actual form structure.
+ $array_parents = isset($element['#array_parents']) ? $element['#array_parents'] : array();
+ $array_parents[] = $key;
+ $element[$key]['#array_parents'] = $array_parents;
// Assign a decimal placeholder weight to preserve original array order.
if (!isset($element[$key]['#weight'])) {