mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +02:00
Mentions: Show initials when no picture for contact
This commit is contained in:
@@ -2723,14 +2723,21 @@ EOF
|
||||
'class' => $sObjectClass,
|
||||
'id' => $iObjectId,
|
||||
'friendlyname' => $oObject->Get('friendlyname'),
|
||||
'initials' => '',
|
||||
];
|
||||
|
||||
if(!empty($sObjectImageAttCode)) {
|
||||
// Try to retrieve image for contact
|
||||
if (!empty($sObjectImageAttCode)) {
|
||||
/** @var \ormDocument $oImage */
|
||||
$oImage = $oObject->Get($sObjectImageAttCode);
|
||||
$aMatch['picture_url'] = $oImage->GetDisplayURL($sTargetClass, $iObjectId, $sObjectImageAttCode);
|
||||
if (!$oImage->IsEmpty()) {
|
||||
$aMatch['picture_url'] = $oImage->GetDisplayURL($sTargetClass, $iObjectId, $sObjectImageAttCode);
|
||||
}
|
||||
}
|
||||
|
||||
// If no image found, fallback on initials
|
||||
$aMatch['initials'] = array_key_exists('picture_url', $aMatch) ? '' : utils::ToAcronym($oObject->Get('friendlyname'));
|
||||
|
||||
$aMatches[] = $aMatch;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user