Skip to content

Commit

Permalink
Merge pull request #29760 from eileenmcnaughton/571
Browse files Browse the repository at this point in the history
dev/core#5090 Fix display of multiple autoselect custom fields
  • Loading branch information
demeritcowboy authored Mar 18, 2024
2 parents 87abb4a + b53d055 commit 94d6be3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CRM/Core/BAO/CustomGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -1264,6 +1264,11 @@ public static function setDefaults(&$groupTree, &$defaults, $viewMode = FALSE, $
}
}
else {
if ($field['html_type'] === 'Autocomplete-Select') {
$checkedValue = array_filter((array) \CRM_Utils_Array::explodePadded($value));
$defaults[$elementName] = implode(',', $checkedValue);
continue;
}
// Values may be "array strings" or actual arrays. Handle both.
if (is_array($value) && count($value)) {
CRM_Utils_Array::formatArrayKeys($value);
Expand All @@ -1274,7 +1279,7 @@ public static function setDefaults(&$groupTree, &$defaults, $viewMode = FALSE, $
}
foreach ($customOption as $val) {
if (in_array($val['value'], $checkedValue)) {
if ($field['html_type'] == 'CheckBox') {
if ($field['html_type'] === 'CheckBox') {
$defaults[$elementName][$val['value']] = 1;
}
else {
Expand Down

0 comments on commit 94d6be3

Please sign in to comment.