Jelajahi Sumber

#4148 - Build-in API support (feed item info)

roman.lesnikov@gmail.com 3 tahun lalu
induk
melakukan
e02328bfc3
1 mengubah file dengan 28 tambahan dan 0 penghapusan
  1. 28 0
      modules/boonex/timeline/classes/BxTimelineTemplate.php

+ 28 - 0
modules/boonex/timeline/classes/BxTimelineTemplate.php

@@ -628,6 +628,34 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
         $aResult = $this->getDataCached($aEvent);
         if($aResult === false)
             return '';
+        
+        if (bx_is_api()){
+            $oProfile = BxDolProfile::getInstanceMagic($aResult['object_owner_id']);
+            $sName = $oProfile->getDisplayName();
+            $sFuncAuthorAddon = '';
+            $sAddon = $sFuncAuthorAddon && is_a($oProfile, 'BxDolProfile') ? $this->$sFuncAuthorAddon($aData, $oProfile) : '';        
+            $sFuncAuthorDesc = '';
+         
+
+            $aVars = [
+                'author_url' => $oProfile->getUrl(),
+                'author_thumb_url' => $oProfile->getThumb(),
+                'author_unit' => BxDolProfile::getData($oProfile, ['display_type' => 'unit_wo_info']),
+                'author_title' => $sName,
+                'author_title_attr' => bx_html_attribute($sName),
+                'author_desc' => $sFuncAuthorDesc ? $this->$sFuncAuthorDesc($aData, $oProfile) : '',
+                'author_profile_desc' => '',
+                'bx_if:addon' => [
+                    'condition' => (bool)$sAddon,
+                    'content' => [
+                        'content' => $sAddon,
+                    ],
+                ],
+            ];
+            return [bx_api_get_block('entity_author', [
+                'author' => $aVars, 
+            ])];
+        }
 
         $sAuthorUnit = $this->getModule()->getObjectUser($aResult['object_owner_id'])->getUnit();