diff --git a/core/metamodel.class.php b/core/metamodel.class.php index 452c40aa8..7a6600c74 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -927,7 +927,8 @@ abstract class MetaModel { self::_check_subclass($sClass); - return self::$m_aClassParams[$sClass]["image_attcode"]; + // image_attcode isn't a mandatory class parameter, so it might not be in the $m_aClassParam array + return isset(self::$m_aClassParams[$sClass]["image_attcode"]) ? self::$m_aClassParams[$sClass]["image_attcode"] : ''; } /** diff --git a/sources/application/UI/Component/Title/TitleFactory.php b/sources/application/UI/Component/Title/TitleFactory.php index 14d3db57c..37123bca1 100644 --- a/sources/application/UI/Component/Title/TitleFactory.php +++ b/sources/application/UI/Component/Title/TitleFactory.php @@ -32,8 +32,8 @@ class TitleFactory $sObjIconUrl = $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 = Title::ENUM_ICON_COVER_METHOD_ZOOMOUT; - // - Use object image from seantic attribute only if it's not the default image - if(!$oObject->IsNew()){ + // - Use object image from semantic attribute only if it's not the default image + if(!$oObject->IsNew() && MetaModel::HasImageAttributeCode($sObjClass)){ $sImageAttCode = MetaModel::GetImageAttributeCode($sObjClass); if(!empty($sImageAttCode)){ /** @var \ormDocument $oImage */ @@ -47,7 +47,10 @@ class TitleFactory } $oTitle = new TitleForObjectDetails($sObjClassName, $sObjName, $sId); - $oTitle->SetIcon($sObjIconUrl, $sIconCoverMethod); + + if(!empty($sObjIconUrl)) { + $oTitle->SetIcon($sObjIconUrl, $sIconCoverMethod); + } $sStatusAttCode = MetaModel::GetStateAttributeCode($sObjClass); if (!empty($sStatusAttCode)) {