Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
into betterselect_process function
// Fix the value arrays; checkboxes are the exact inverse of multiselect,
// apparently for vindictive fun.
// First make sure there's at least 1 non-blank array element
$temp = $element['#default_value'];
$temp = array_shift($element['#default_value']);
if (!empty($temp)) {
$element['#default_value'] = array_flip($element['#default_value']);
$element['#value'] = array_flip($element['#value']);
}
- the $temp get a value shifted! from $element['#default_value'] which gets irreparably lost and never recovered
- sure about $element['#default_value'] = array_flip($element['#default_value']) ?
-- when stepping through a debugger I reach this point with the following default taxonomy selected
0 => 1
1 => 2
2 => 4
after the shifted value:
0 => 2
1 => 4
then flipped:
2 => 0
4 => 1
the first item in the array becomes unchecked, since it index is always zero
shouldn't be used drupal_map_assoc here?