Skip to content

Instantly share code, notes, and snippets.

@webwaymen
Last active June 1, 2020 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webwaymen/2464f94c6654f9591c1ce2088fecc815 to your computer and use it in GitHub Desktop.
Save webwaymen/2464f94c6654f9591c1ce2088fecc815 to your computer and use it in GitHub Desktop.
Модифицированная функция для модуля изображений
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