Commit 133617cb authored by drumm's avatar drumm

#57834 by chx, Replace theme_weight with more appropriate process_weight

parent a6588672
......@@ -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;
}
/**
......
......@@ -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);
......
......@@ -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);
......
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