summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-02-13 04:43:00 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-02-13 04:43:00 +0000
commitb83aa19bb29b7de0f16dcb25e8d7abeb8b10ac2f (patch)
tree4fe200b7863dad0385d97f5a044584bf2330c1d1 /includes
parent826cf54d84ab7d8d08fcb7d73397fc2b0ae6ae97 (diff)
downloadbrdo-b83aa19bb29b7de0f16dcb25e8d7abeb8b10ac2f.tar.gz
brdo-b83aa19bb29b7de0f16dcb25e8d7abeb8b10ac2f.tar.bz2
#370846 follow-up by catch: Fix #weight sorting in drupal_render().
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc12
1 files changed, 10 insertions, 2 deletions
diff --git a/includes/common.inc b/includes/common.inc
index c1dc6f8f2..7b97fe67d 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -3493,11 +3493,19 @@ function element_children(&$elements, $sort = FALSE) {
}
}
}
- // Sort the element if necessary.
+ // Sort the children if necessary.
if ($sort && $sortable) {
uasort($children, 'element_sort');
+ // Put the sorted children back into $elements in the correct order, to
+ // preserve sorting if the same element is passed through
+ // element_children() twice.
+ foreach ($children as $key => $child) {
+ unset($elements[$key]);
+ $elements[$key] = $child;
+ }
+ $elements['#sorted'] = TRUE;
}
- $elements['#sorted'] = TRUE;
+
return array_keys($children);
}