FluidTYPO3\Vhs\Traits\TagViewHelperTrait::renderChildTag PHP Method

renderChildTag() protected method

Renders the provided tag and optionally appends or prepends it to the main tag's content depending on 'mode' which can be one of 'none', 'append' or 'prepend'
protected renderChildTag ( string $tagName, array $attributes = [], boolean $forceClosingTag = false, string $mode = 'none' ) : string
$tagName string
$attributes array
$forceClosingTag boolean
$mode string
return string
    protected function renderChildTag($tagName, $attributes = [], $forceClosingTag = false, $mode = 'none')
    {
        $tagBuilder = clone $this->tag;
        $tagBuilder->reset();
        $tagBuilder->setTagName($tagName);
        $tagBuilder->addAttributes($attributes);
        $tagBuilder->forceClosingTag($forceClosingTag);
        $childTag = $tagBuilder->render();
        if ('append' === $mode || 'prepend' === $mode) {
            $content = $this->tag->getContent();
            if ('append' === $mode) {
                $content = $content . $childTag;
            } else {
                $content = $childTag . $content;
            }
            $this->tag->setContent($content);
        }
        return $childTag;
    }