Przeglądaj źródła

Ticket #4971 - Build-in API support: Issues in Videos module.

AntonLV 9 miesięcy temu
rodzic
commit
23ebb3bdd5

+ 8 - 4
modules/boonex/videos/classes/BxVideosModule.php

@@ -184,14 +184,18 @@ class BxVideosModule extends BxBaseModFilesModule
 
 
         if($this->_bIsApi && $mixedResult && is_array($mixedResult)) {
         if($this->_bIsApi && $mixedResult && is_array($mixedResult)) {
             $aContentInfo = $this->_oDb->getContentInfoById($aEvent['object_id']);
             $aContentInfo = $this->_oDb->getContentInfoById($aEvent['object_id']);
-            
+
             switch($aContentInfo['video_source']) {
             switch($aContentInfo['video_source']) {
                 case 'embed':
                 case 'embed':
-                    if(($sKey = 'video_embed') && !empty($aContentInfo[$sKey]))
+                    if(($sKey = 'video_embed') && !empty($aContentInfo[$sKey])) {
+                        bx_import('BxDolEmbed');
+                        $aEmbed = ($oEmbed = BxDolEmbed::getObjectInstance('sys_system')) !== false ? $oEmbed->getLinkHTML($aContentInfo[$sKey]) : ['url' => $aContentInfo[$sKey]];
+
                         $mixedResult['content'] = array_merge($mixedResult['content'], [
                         $mixedResult['content'] = array_merge($mixedResult['content'], [
-                            'embed' => $aContentInfo[$sKey],
+                            'embed' => $aEmbed,
                             'images' => []
                             'images' => []
                         ]);
                         ]);
+                    }
                     break;
                     break;
 
 
                 case 'upload':
                 case 'upload':
@@ -201,7 +205,7 @@ class BxVideosModule extends BxBaseModFilesModule
                     break;
                     break;
             }
             }
         }
         }
-        
+
         return $mixedResult;
         return $mixedResult;
     }
     }