diff --git a/includes/form.inc b/includes/form.inc index 16c49f265ed8f9f3c3b63f6dd4ad627d042c313c..92d25f4cc68d201fb20da4dbdb4c6382011030d6 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -1071,22 +1071,16 @@ function theme_password($element) { } /** - * Format a weight selection menu. - * - * @param $element - * An associative array containing the properties of the element. - * Properties used: title, delta, description - * @return - * A themed HTML string representing the form. + * Expand weight elements into selects. */ -function theme_weight($element) { +function process_weight($element) { for ($n = (-1 * $element['#delta']); $n <= $element['#delta']; $n++) { $weights[$n] = $n; } $element['#options'] = $weights; $element['#type'] = 'select'; - - return form_render($element); + $element['#is_weight'] = TRUE; + return $element; } /** diff --git a/modules/system.module b/modules/system.module index b243d01fd31fae2cb06f39ea367e28bbbf010e4d..5a6a2e3f48fa7ace2eff8dc0e39116b67c5073c3 100644 --- a/modules/system.module +++ b/modules/system.module @@ -72,7 +72,7 @@ function system_elements() { $type['radio'] = array('#input' => TRUE); $type['checkboxes'] = array('#input' => TRUE, '#process' => array('expand_checkboxes' => array()), '#tree' => TRUE); $type['select'] = array('#input' => TRUE); - $type['weight'] = array('#input' => TRUE, '#delta' => 10, '#default_value' => 0); + $type['weight'] = array('#input' => TRUE, '#delta' => 10, '#default_value' => 0, '#process' => array('process_weight' => array())); $type['date'] = array('#input' => TRUE, '#process' => array('expand_date' => array())); $type['file'] = array('#input' => TRUE, '#size' => 60); diff --git a/modules/system/system.module b/modules/system/system.module index b243d01fd31fae2cb06f39ea367e28bbbf010e4d..5a6a2e3f48fa7ace2eff8dc0e39116b67c5073c3 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -72,7 +72,7 @@ function system_elements() { $type['radio'] = array('#input' => TRUE); $type['checkboxes'] = array('#input' => TRUE, '#process' => array('expand_checkboxes' => array()), '#tree' => TRUE); $type['select'] = array('#input' => TRUE); - $type['weight'] = array('#input' => TRUE, '#delta' => 10, '#default_value' => 0); + $type['weight'] = array('#input' => TRUE, '#delta' => 10, '#default_value' => 0, '#process' => array('process_weight' => array())); $type['date'] = array('#input' => TRUE, '#process' => array('expand_date' => array())); $type['file'] = array('#input' => TRUE, '#size' => 60);