Explorar el Código

Ticket #4148 - Build-in API support: Remove duplicated Author data in Content/Context/Profile snippets.

AntonLV hace 3 años
padre
commit
6573d838c2

+ 7 - 8
modules/base/profile/classes/BxBaseModProfileSearchResult.php

@@ -247,17 +247,16 @@ class BxBaseModProfileSearchResult extends BxBaseModGeneralSearchResult
         $oContentInfo = $this->getContentInfoObject();
 
         foreach ($a as $i => $r) {
-            if (isset($r['author']))
-                $a[$i]['author_data'] = BxDolProfile::getData($r[$CNF['FIELD_AUTHOR']]);
-
-            $a[$i]['url'] = $this->decodeDataUrl($oContentInfo, $r);
-            $a[$i]['image'] = $oContentInfo->getContentThumb($r['id']);
-            $a[$i]['cover'] = $oContentInfo->getContentCover($r['id']);
-            $a[$i]['summary_plain'] = $this->decodeDataSummaryPlain($oContentInfo, $r);
+            $a[$i] = array_merge($a[$i], [
+                'url' => $this->decodeDataUrl($oContentInfo, $r),
+                'image' => $oContentInfo->getContentThumb($r['id']),
+                'cover' => $oContentInfo->getContentCover($r['id']),
+                'summary_plain' => $this->decodeDataSummaryPlain($oContentInfo, $r)
+            ]);
 
             if($bMetaMenu) {
                 $bPublic = !$bPrivacy || $oPrivacy->check($r[$CNF['FIELD_ID']]) || $oPrivacy->isPartiallyVisible($r[$CNF['FIELD_ALLOW_VIEW_TO']]);
-                
+
                 $oMetaMenu->setContentId($r['id']);
                 $oMetaMenu->setContentPublic($bPublic);
                 $a[$i]['meta'] = $oMetaMenu->getCodeAPI();

+ 5 - 6
modules/base/text/classes/BxBaseModTextSearchResult.php

@@ -247,12 +247,11 @@ class BxBaseModTextSearchResult extends BxBaseModGeneralSearchResult
         $oContentInfo = $this->getContentInfoObject();
 
         foreach ($a as $i => $r) {
-            if (isset($r['author']))
-                $a[$i]['author_data'] = BxDolProfile::getData($r[$CNF['FIELD_AUTHOR']]);
-
-            $a[$i]['url'] = $this->decodeDataUrl($oContentInfo, $r);
-            $a[$i]['image'] = $oContentInfo->getContentThumb($r['id']);
-            $a[$i]['summary_plain'] = $this->decodeDataSummaryPlain($oContentInfo, $r);
+            $a[$i] = array_merge($a[$i], [
+                'url' => $this->decodeDataUrl($oContentInfo, $r),
+                'image' => $oContentInfo->getContentThumb($r['id']),
+                'summary_plain' => $this->decodeDataSummaryPlain($oContentInfo, $r)
+            ]);
 
             if($bMetaMenu) {
                 $oMetaMenu->setContentId($r['id']);