Preferences: Fix some default values were not shown correctly

Preferences that had options with label & value keys were done by index instead of value
This commit is contained in:
nathan 2023-06-15 10:11:04 -06:00
parent b83887d44a
commit 9b6a14f2d8

View File

@ -685,11 +685,11 @@ class preferences_settings
} }
foreach($labels as &$def) foreach($labels as &$def)
{ {
if (isset($values[$def])) if(isset($values[$def]) && (!is_array($values[$def]) || $values[$def]['value'] == $def))
{ {
$def = is_array($values[$def]) ? $values[$def]['label'] : $values[$def]; $def = is_array($values[$def]) ? $values[$def]['label'] : $values[$def];
} }
else // value could be in an optgroup else // value could be in an optgroup or array with label & value keys
{ {
foreach($values as $value) foreach($values as $value)
{ {