Commit 5187fa6f authored by Dries's avatar Dries
Browse files

- Patch #639418 by sun: #array_parents() do not always map to actual form structure.

parent 2fad47da
......@@ -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'])) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment