public function toHTML(\Ibrows\SimpleCMSBundle\Helper\HtmlFilter $filter,array $args){ $return =''; $arr = parent::mergeUserArgs($args, array('attr'=>array('class'=>'simplecms-textcontent'))); foreach($arr['attr'] as $key => $val){ $return .= "$key=\"$val\""; } $text = $this->getText(); if(!isset ($args['html']) || $args['html'] != true){ $text = $filter->filterHtml($text); $text = nl2br($text); } return '<span '.$return.'>' .$text. '</span>' ; }
public function toHTML(\Ibrows\SimpleCMSBundle\Helper\HtmlFilter $filter,array $args){ $return =''; $arr = parent::mergeUserArgs($args, array('attr'=>array('class'=>'simplecms-imagecontent','alt'=>$this->getName(),'title'=>$this->getName()))); foreach($arr['attr'] as $key => $val){ $return .= "$key=\"$val\""; } $return = '<img src="/'.$this->getWebPath().'" '.$return.' ">'; return $return; ; }
public function toHTML(\Ibrows\SimpleCMSBundle\Helper\HtmlFilter $filter, array $args) { $return = ''; $name = $filter->filterHtml($this->getName()); $config = array('attr' => array('class' => 'simplecms-imagecontent', 'alt' => $name, 'title' => $name)); $image = true; try { $mimetpye = \Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser::getInstance()->guess($this->getWebPath()); if (strpos($mimetpye, 'image') !== 0) { $image = false; } } catch (\Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException $e) { } if (!$image) { //if not a image $config = array('attr' => array('class' => 'simplecms-downloadcontent', 'title' => $name)); } $arr = parent::mergeUserArgs($args, $config); foreach ($arr['attr'] as $key => $val) { $return .= "{$key}=\"{$val}\""; } if (!$image) { //if not a image return '<a href="/' . $this->getWebPath() . '" ' . $return . ' ">' . $name . ' </a>'; } $return = '<img src="/' . $this->getWebPath() . '" ' . $return . ' ">'; return $return; }