Latte\Runtime\Template::renderBlock PHP Method

renderBlock() protected method

Renders block.
protected renderBlock ( $name, array $params, $mod = NULL ) : void
$params array
return void
    protected function renderBlock($name, array $params, $mod = NULL)
    {
        if (empty($this->blockQueue[$name])) {
            $hint = isset($this->blockQueue) && ($t = Latte\Helpers::getSuggestion(array_keys($this->blockQueue), $name)) ? ", did you mean '{$t}'?" : '.';
            throw new \RuntimeException("Cannot include undefined block '{$name}'{$hint}");
        }
        $block = reset($this->blockQueue[$name]);
        if ($mod && $mod !== ($blockType = $this->blockTypes[$name])) {
            if ($filter = is_string($mod) ? Filters::getConvertor($blockType, $mod) : $mod) {
                echo $filter($this->capture(function () use($block, $params) {
                    $block($params);
                }), $blockType);
                return;
            }
            trigger_error("Including block {$name} with content type " . strtoupper($blockType) . ' into incompatible type ' . strtoupper($mod) . '.', E_USER_WARNING);
        }
        $block($params);
    }