Skip to content

Commit 0d09e0d

Browse files
MyvTsvRom1-B
andauthored
fix(searchoption): default value not displayed when field is not set (#985)
* fix(searchoption): default value not displayed when field is not set * CHANGELOG.md * Update inc/abstractcontainerinstance.class.php Co-authored-by: Romain B. <8530352+Rom1-B@users.noreply.github.com> * fix lint --------- Co-authored-by: Romain B. <8530352+Rom1-B@users.noreply.github.com>
1 parent 7ee9e38 commit 0d09e0d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
88
## [UNRELEASE]
99

1010
- Fix incompatibility of `multiple` dropdowns with `massiveaction`
11+
- Fix default value properly applied in multiple dropdown search options
1112

1213
## [1.21.22] - 2025-05-28
1314

inc/abstractcontainerinstance.class.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,11 @@ public static function getSpecificValueToDisplay($field, $values, array $options
159159
) {
160160
$itemtype = PluginFieldsDropdown::getClassname($field_specs->fields['name']);
161161
if (empty($values[$field])) {
162-
return ''; // Value not defined
162+
if (!empty($field_specs->fields["default_value"])) {
163+
$values[$field] = $field_specs->fields['default_value'];
164+
} else {
165+
return ''; // Value not defined
166+
}
163167
}
164168
$values = json_decode($values[$field]);
165169
if (!is_array($values)) {

0 commit comments

Comments
 (0)