Skip to content

Commit ba1ac34

Browse files
committed
fix(form): loss of icon when editing a form
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
1 parent c1e3f91 commit ba1ac34

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

inc/common.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public static function showFontAwesomeDropdown(string $name, array $options = []
186186
'noselect2' => true, // we will instanciate it later
187187
'display_emptychoice' => true,
188188
'rand' => mt_rand(),
189-
];
189+
] + $options;
190190
if (!isset($options['value'])) {
191191
$options['value'] = '';
192192
}

inc/form.class.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,10 @@ public static function getSpecificValueToSelect($field, $name = '', $values = ''
312312
/**
313313
* Define how to display a specific value in search result table
314314
*
315-
* @param String $field Name of the field as define in $this->getSearchOptions()
316-
* @param Mixed $values The value as it is stored in DB
317-
* @param Array $options Options (optional)
318-
* @return Mixed Value to be displayed
315+
* @param string $field Name of the field as define in $this->getSearchOptions()
316+
* @param mixed $values The value as it is stored in DB
317+
* @param array $options Options (optional)
318+
* @return mixed Value to be displayed
319319
*/
320320
public static function getSpecificValueToDisplay($field, $values, array $options = []) {
321321
if (!is_array($values)) {
@@ -366,6 +366,17 @@ public static function getSpecificValueToDisplay($field, $values, array $options
366366
return Dropdown::getLanguageName($values[$field]);
367367
}
368368
break;
369+
370+
case 'icon':
371+
if ($values[$field] == '') {
372+
return '';
373+
}
374+
return '<i class="' . $values[$field] . '"></i>';
375+
break;
376+
377+
case 'icon_color':
378+
case 'background_color':
379+
return '<span style="background: ' . $values[$field] . '">&nbsp;&nbsp;&nbsp;&nbsp;</span>';
369380
}
370381

371382
return parent::getSpecificValueToDisplay($field, $values, $options);

0 commit comments

Comments
 (0)