Skip to content

Commit

Permalink
fix(form): loss of icon when editing a form
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <[email protected]>
  • Loading branch information
btry committed Feb 10, 2021
1 parent c1e3f91 commit ba1ac34
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion inc/common.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public static function showFontAwesomeDropdown(string $name, array $options = []
'noselect2' => true, // we will instanciate it later
'display_emptychoice' => true,
'rand' => mt_rand(),
];
] + $options;
if (!isset($options['value'])) {
$options['value'] = '';
}
Expand Down
19 changes: 15 additions & 4 deletions inc/form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,10 @@ public static function getSpecificValueToSelect($field, $name = '', $values = ''
/**
* Define how to display a specific value in search result table
*
* @param String $field Name of the field as define in $this->getSearchOptions()
* @param Mixed $values The value as it is stored in DB
* @param Array $options Options (optional)
* @return Mixed Value to be displayed
* @param string $field Name of the field as define in $this->getSearchOptions()
* @param mixed $values The value as it is stored in DB
* @param array $options Options (optional)
* @return mixed Value to be displayed
*/
public static function getSpecificValueToDisplay($field, $values, array $options = []) {
if (!is_array($values)) {
Expand Down Expand Up @@ -366,6 +366,17 @@ public static function getSpecificValueToDisplay($field, $values, array $options
return Dropdown::getLanguageName($values[$field]);
}
break;

case 'icon':
if ($values[$field] == '') {
return '';
}
return '<i class="' . $values[$field] . '"></i>';
break;

case 'icon_color':
case 'background_color':
return '<span style="background: ' . $values[$field] . '">&nbsp;&nbsp;&nbsp;&nbsp;</span>';
}

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

0 comments on commit ba1ac34

Please sign in to comment.