custom/form_helper/form_helper.module, line 59
form_helper_set_weight(&$form, $start_weight = -50)Set a form elements weight if it is defined.
<?php
function form_helper_set_weight(&$form, $start_weight = -50) {
foreach (array_keys($form['menu']) as $key ) {
if (strpos($key, '#') !== 0 && !isset($form[$key]['#weight']) ) {
$form[$key]['#weight'] = $start_weight++;
}
}
}
?>