Set('title', $sTitle); $oEvent->Set('message', $sMessage); // Compute icon // - First check if one is defined on the action if (false === $oAction->Get('icon')->IsEmpty()) { $oIcon = $oAction->Get('icon'); } // - Then, check if the action is for a DM object and if its class has an icon elseif ($iObjectId > 0 && utils::IsNotNullOrEmptyString(MetaModel::GetClassIcon($sObjectClass, false))) { $oIcon = MetaModel::GetAttributeDef(EventNotificationNewsroom::class, 'icon')->MakeRealValue(MetaModel::GetClassIcon($sObjectClass, false), $oEvent); } // - Otherwise, fallback on the compact logo of the application else { $oIcon = MetaModel::GetAttributeDef(EventNotificationNewsroom::class, 'icon')->MakeRealValue(Branding::GetCompactMainLogoAbsoluteUrl(), $oEvent); } $oEvent->Set('icon', $oIcon); $oEvent->Set('priority', $oAction->Get('priority')); $oEvent->Set('contact_id', $iContactId); $oEvent->Set('trigger_id', $iTriggerId); $oEvent->Set('action_id', $oAction->GetKey()); $oEvent->Set('object_id', $iObjectId); $oEvent->Set('object_class', $sObjectClass); $oEvent->Set('url', $sUrl); if ($sDate !== null) { $oEvent->Set('date', $sDate); } else { $oEvent->SetCurrentDate('date'); } return $oEvent; } }