mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 11:38:44 +02:00
N°3917 Refactor algorithm to get object details semantic image icon in object's GetIcon method in order to propagate this feature anywhere where GetIcon is called
This commit is contained in:
@@ -204,20 +204,7 @@ class ObjectDetails extends Panel implements iKeyboardShortcut
|
||||
// Default icon is the class icon
|
||||
$sIconUrl = $oObject->GetIcon(false);
|
||||
// Note: Class icons are a square image with no margin around, so they need to be zoomed out in the medallion
|
||||
$sIconCoverMethod = static::ENUM_ICON_COVER_METHOD_ZOOMOUT;
|
||||
// Use object image from semantic attribute only if it's not the default image
|
||||
if (!$oObject->IsNew() && MetaModel::HasImageAttributeCode($this->sClassName)) {
|
||||
$sImageAttCode = MetaModel::GetImageAttributeCode($this->sClassName);
|
||||
if (!empty($sImageAttCode)) {
|
||||
/** @var \ormDocument $oImage */
|
||||
$oImage = $oObject->Get($sImageAttCode);
|
||||
if (!$oImage->IsEmpty()) {
|
||||
$sIconUrl = $oImage->GetDisplayURL($this->sClassName, $this->sObjectId, $sImageAttCode);
|
||||
$sIconCoverMethod = static::ENUM_ICON_COVER_METHOD_COVER;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$sIconCoverMethod = $oObject->HasInstanceIcon() ? static::ENUM_ICON_COVER_METHOD_COVER : static::ENUM_ICON_COVER_METHOD_ZOOMOUT;
|
||||
|
||||
$this->SetIcon($sIconUrl, $sIconCoverMethod, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user