Просмотр исходного кода

#4148 Build-in API support (embeds theme support)

roman.lesnikov@gmail.com 3 лет назад
Родитель
Сommit
8305752bd0
2 измененных файлов с 8 добавлено и 4 удалено
  1. 2 2
      oembed.php
  2. 6 2
      template/scripts/BxBaseEmbedEmbedly.php

+ 2 - 2
oembed.php

@@ -43,8 +43,8 @@ if (bx_get('html')){
     position: relative;
     width: auto;
     height: auto;
-}</style><script language="javascript" src="/plugins_public/jquery/jquery.min.js"></script>' . $oEmbed->addJsCss() . '<div style="max-width:900; margin:0px auto; justify-content: center; display:flex">' . $oEmbed->getLinkHTML($aLinks) .'</div>' . $oEmbed->addProcessLinkMethod() . '</body>';
+}</style><script language="javascript" src="'.BX_DOL_URL_ROOT.'/plugins_public/jquery/jquery.min.js"></script>' . $oEmbed->addJsCss() . '<div style="max-width:900; margin:0px auto; justify-content: center; display:flex">' . $oEmbed->getLinkHTML($aLinks, '', '', bx_get('theme')) .'</div></body>';
     exit();
 }
-
+//data-card-theme
 echoJson($oEmbed->parseLinks($aLinks));

+ 6 - 2
template/scripts/BxBaseEmbedEmbedly.php

@@ -23,11 +23,15 @@ class BxBaseEmbedEmbedly extends BxDolEmbed
             $this->_oTemplate = BxDolTemplate::getInstance();
     }
 
-    public function getLinkHTML ($sLink, $sTitle = '', $sMaxWidth = '')
+    public function getLinkHTML ($sLink, $sTitle = '', $sMaxWidth = '', $sTheme = '')
     {
         $aAttrs = array(
-            'title' => bx_html_attribute($sTitle),
+            'title' => bx_html_attribute($sTitle)
         );
+        
+        if ($sTheme != ''){
+            $aAttrs['data-card-theme'] = $sTheme;
+        }
 
         // check for external link
         if (strncmp(BX_DOL_URL_ROOT, $sLink, strlen(BX_DOL_URL_ROOT)) !== 0) {