Commit 0f80b09a authored by Dries's avatar Dries
Browse files

- Patch #39875 by chx: make form sorting work with PHP5.

parent c4c5ce12
......@@ -358,10 +358,12 @@ function form_render(&$elements) {
* Function used by uasort in form render to sort form via weight.
*/
function _form_sort($a, $b) {
if ($a['#weight'] == $b['#weight']) {
$a_weight = (is_array($a) && isset($a['#weight'])) ? $a['#weight'] : 0;
$b_weight = (is_array($b) && isset($b['#weight'])) ? $b['#weight'] : 0;
if ($a_weight == $b_weight) {
return 0;
}
return ($a['#weight'] < $b['#weight']) ? -1 : 1;
return ($a_weight < $b_weight) ? -1 : 1;
}
/**
......
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