getBlockStack example


        }

        return $node;
    }

    public function getFunctionNode($name$line)
    {
        switch ($name) {
            case 'parent':
                $this->parseArguments();
                if (!\count($this->parser->getBlockStack())) {
                    throw new SyntaxError('Calling "parent" outside a block is forbidden.', $line$this->parser->getStream()->getSourceContext());
                }

                if (!$this->parser->getParent() && !$this->parser->hasTraits()) {
                    throw new SyntaxError('Calling "parent" on a template that does not extend nor "use" another template is forbidden.', $line$this->parser->getStream()->getSourceContext());
                }

                return new ParentExpression($this->parser->peekBlockStack()$line);
            case 'block':
                $args = $this->parseArguments();
                if (\count($args) < 1) {
                    
Home | Imprint | This part of the site doesn't use cookies.