FluidTYPO3\Vhs\ViewHelpers\Format\Placeholder\ImageViewHelper::render PHP Method

render() public method

public render ( string $text = null ) : string
$text string
return string
    public function render($text = null)
    {
        if (null === $text) {
            $text = $this->renderChildren();
        }
        $height = $this->arguments['height'] != $this->arguments['width'] ? $this->arguments['height'] : null;
        $addHeight = false === empty($height) ? 'x' . $height : null;
        $url = ['https://placehold.it', $this->arguments['width'] . $addHeight, $this->arguments['backgroundColor'], $this->arguments['textColor']];
        if (false === empty($text)) {
            array_push($url, '&text=' . urlencode($text));
        }
        $imageUrl = implode('/', $url);
        $this->tag->forceClosingTag(false);
        $this->tag->addAttribute('src', $imageUrl);
        $this->tag->addAttribute('alt', $imageUrl);
        $this->tag->addAttribute('width', $this->arguments['width']);
        $this->tag->addAttribute('height', false === empty($height) ? $height : $this->arguments['width']);
        return $this->tag->render();
    }