1<?php 2 3 4namespace ComboStrap; 5 6 7/** 8 * Class ImageLink 9 * @package ComboStrap 10 * 11 * A media of image type 12 */ 13abstract class ImageLink extends MediaLink 14{ 15 16 17 /** 18 * @return Image 19 */ 20 function getDefaultImage(): ?Image 21 { 22 if (!($this->getMedia() instanceof Image)) { 23 LogUtility::msg("The media ($this) is not an image", LogUtility::LVL_MSG_ERROR); 24 } 25 /** 26 * 27 */ 28 $media = $this->getMedia(); 29 if($media instanceof Image){ 30 return $media; 31 } else { 32 return null; 33 } 34 } 35 36 /** 37 * @return string the wiki syntax 38 */ 39 public function getMarkupSyntax(): string 40 { 41 $descriptionPart = ""; 42 if (!empty($this->getDefaultImage()->getAltNotEmpty())) { 43 $descriptionPart = "|" . $this->getDefaultImage()->getAltNotEmpty(); 44 } 45 return '{{' . $this->getMedia()->getPath()->getAbsolutePath() . $descriptionPart . '}}'; 46 } 47 48} 49