FluidTYPO3\Vhs\ViewHelpers\Media\YoutubeViewHelper::render PHP Method

render() public method

Render method
public render ( ) : string
return string
    public function render()
    {
        $videoId = $this->arguments['videoId'];
        $width = $this->arguments['width'];
        $height = $this->arguments['height'];
        $this->tag->addAttribute('width', $width);
        $this->tag->addAttribute('height', $height);
        $src = $this->getSourceUrl($videoId);
        if (false === (bool) $this->arguments['legacyCode']) {
            $this->tag->addAttribute('src', $src);
            $this->tag->addAttribute('frameborder', 0);
            $this->tag->addAttribute('allowFullScreen', 'allowFullScreen');
            $this->tag->forceClosingTag(true);
        } else {
            $this->tag->setTagName('object');
            $tagContent = '';
            $paramAttributes = ['movie' => $src, 'allowFullScreen' => 'true', 'scriptAccess' => 'always'];
            foreach ($paramAttributes as $name => $value) {
                $tagContent .= $this->renderChildTag('param', [$name => $value], true);
            }
            $embedAttributes = ['src' => $src, 'type' => 'application/x-shockwave-flash', 'width' => $width, 'height' => $height, 'allowFullScreen' => 'true', 'scriptAccess' => 'always'];
            $tagContent .= $this->renderChildTag('embed', $embedAttributes, true);
            $this->tag->setContent($tagContent);
        }
        return $this->tag->render();
    }