Contao\TemplateInheritance::endblock PHP Метод

endblock() публичный Метод

End a block
public endblock ( )
    public function endblock()
    {
        // Check for open blocks
        if (empty($this->arrBlockNames)) {
            throw new \Exception('You must start a block before you can end it');
        }
        // Get the block name
        $name = array_pop($this->arrBlockNames);
        // Root template
        if ($this->strParent === null) {
            // Handle nested blocks
            if ($this->arrBlocks[$name] != '[[TL_PARENT]]') {
                // Output everything after the first TL_PARENT tag
                if (strpos($this->arrBlocks[$name], '[[TL_PARENT]]') !== false) {
                    list(, $content) = explode('[[TL_PARENT]]', $this->arrBlocks[$name], 2);
                    echo $content;
                } else {
                    ob_end_clean();
                }
            }
        } else {
            // Capture the block content
            $this->arrBlocks[$name][] = ob_get_clean();
            // Start a new output buffer
            ob_start();
        }
    }