diff --git a/application/utils.inc.php b/application/utils.inc.php
index 1c45e7121..a7d6aee13 100644
--- a/application/utils.inc.php
+++ b/application/utils.inc.php
@@ -2656,7 +2656,7 @@ class utils
$sMentionItemUrl = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?operation=details&class='.$sMentionClass.'&id={id}';
$sMentionItemPictureTemplate = (empty(MetaModel::GetImageAttributeCode($sMentionClass))) ? '' : <<{initials}
+{initials}
HTML;
$sMentionItemTemplate = <<{$sMentionItemPictureTemplate}{friendlyname}
diff --git a/pages/ajax.render.php b/pages/ajax.render.php
index 94d6ca570..92c1911bd 100644
--- a/pages/ajax.render.php
+++ b/pages/ajax.render.php
@@ -2720,10 +2720,9 @@ EOF
$sObjectClass = get_class($oObject);
$iObjectId = $oObject->GetKey();
$aMatch = [
- 'class' => $sObjectClass,
- 'id' => $iObjectId,
+ 'class' => $sObjectClass,
+ 'id' => $iObjectId,
'friendlyname' => $oObject->Get('friendlyname'),
- 'initials' => '',
];
// Try to retrieve image for contact
@@ -2731,13 +2730,15 @@ EOF
/** @var \ormDocument $oImage */
$oImage = $oObject->Get($sObjectImageAttCode);
if (!$oImage->IsEmpty()) {
- $aMatch['picture_url'] = $oImage->GetDisplayURL($sObjectClass, $iObjectId, $sObjectImageAttCode);
+ $aMatch['picture_style'] = "background-image: url('".$oImage->GetDisplayURL($sObjectClass, $iObjectId, $sObjectImageAttCode)."')";
+ $aMatch['initials'] = '';
+ } else {
+ // If no image found, fallback on initials
+ $aMatch['picture_style'] = '';
+ $aMatch['initials'] = utils::ToAcronym($oObject->Get('friendlyname'));
}
}
- // If no image found, fallback on initials
- $aMatch['initials'] = array_key_exists('picture_url', $aMatch) ? '' : utils::ToAcronym($oObject->Get('friendlyname'));
-
$aMatches[] = $aMatch;
}
}