Sfoglia il codice sorgente

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

roman.lesnikov@gmail.com 3 anni fa
parent
commit
6ffb5a3fbe

+ 10 - 2
inc/classes/BxDolForm.php

@@ -978,10 +978,18 @@ class BxDolForm extends BxDol implements iBxDolReplaceable
         $oChecker = new $this->_sChecker($this->_sCheckerHelper);
         $oChecker->setFormMethod($this->aFormAttrs['method'], $this->_aSpecificValues);
         $a = isset($this->aInputs[$sName]) ? $this->aInputs[$sName] : false;
+        $oRv = null;
+        
         if ($a && isset($a['db']['pass']))
-            return $oChecker->get ($a['name'], $a['db']['pass'], isset($a['db']['params']) && $a['db']['params'] ? $a['db']['params'] : array());
+            $oRv = $oChecker->get ($a['name'], $a['db']['pass'], isset($a['db']['params']) && $a['db']['params'] ? $a['db']['params'] : array());
         else
-           return $oChecker->get ($sName);
+            $oRv =  $oChecker->get ($sName);
+        
+        // process comma separated string for api values
+        if (bx_is_api() && isset($this->aInputs[$sName]['type']) && in_array($this->aInputs[$sName]['type'], ['checkbox_set', 'files', 'select_multiple']))
+            $oRv = explode(',', $oRv);
+            
+        return $oRv;
     }
 
     function isSubmitted ()

+ 6 - 0
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -2103,6 +2103,12 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
         ));
 
         $aItemData = $this->getItemData($iItemId, $aParams);
+        
+        if (bx_is_api()){
+            $aItemData['event']['author_data'] = BxDolProfile::getData($aItemData['event']['object_owner_id']);
+            return [bx_api_get_block('feed_item', $aItemData)];
+        }
+        
         return $this->_oTemplate->getItemBlock($aItemData, $aParams);
     }