Skip to content
Snippets Groups Projects
Commit 133617cb authored by Neil Drumm's avatar Neil Drumm :wave:
Browse files

#57834 by chx, Replace theme_weight with more appropriate process_weight

parent a6588672
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment