Beispiel #1
0
 /**
  * Render html of media.
  *
  * @param MediaInterface    $media
  * @param string|array|null $alias
  *
  * @return string render of media html
  */
 public function getHtml(MediaInterface $media, $alias = null)
 {
     if ($media->getType() == $media::IMAGE) {
         $template = 'ApoutchikaMediaBundle:Render:image.html.twig';
     } elseif ($media->getType() == $media::VIDEO) {
         $template = 'ApoutchikaMediaBundle:Render:video.html.twig';
     } elseif ($media->getType() == $media::AUDIO) {
         $template = 'ApoutchikaMediaBundle:Render:audio.html.twig';
     } else {
         $template = 'ApoutchikaMediaBundle:Render:other.html.twig';
     }
     return $this->container->get('templating')->render($template, array('media' => $media, 'alias' => $alias, 'url' => $this->getAbsoluteUrl($media, $alias)));
 }