Last active
June 1, 2020 10:38
-
-
Save webwaymen/2464f94c6654f9591c1ce2088fecc815 to your computer and use it in GitHub Desktop.
Модифицированная функция для модуля изображений
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function BuildHTML($sPath,$aParams) { | |
$sText='<figure itemprop="image"><img itemtype="https://schema.org/ImageObject" src="'.$sPath.'" '; | |
if (isset($aParams['title']) and $aParams['title']!='') { | |
$sText.=''; | |
/** | |
* Если не определен ALT заполняем его тайтлом | |
*/ | |
if(!isset($aParams['alt'])) $aParams['alt']=$aParams['title']; | |
} | |
if (isset($aParams['align']) and in_array($aParams['align'],array('left','right','center'))) { | |
if ($aParams['align'] == 'center') { | |
$sText.=' class="image-center"'; | |
} else { | |
$sText.=' align="'.htmlspecialchars($aParams['align']).'" '; | |
} | |
} | |
$sText.=$sAlt.'/><meta itemprop="url" content="'.$sPath.'"><figcaption>'.htmlspecialchars($aParams['alt']).'</figcaption></figure>'; | |
return $sText; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment