SetNode example

if ($node instanceof TransDefaultDomainNode) {
            if ($node->getNode('expr') instanceof ConstantExpression) {
                $this->scope->set('domain', $node->getNode('expr'));

                return $node;
            } else {
                $var = $this->getVarName();
                $name = new AssignNameExpression($var$node->getTemplateLine());
                $this->scope->set('domain', new NameExpression($var$node->getTemplateLine()));

                return new SetNode(false, new Node([$name])new Node([$node->getNode('expr')])$node->getTemplateLine());
            }
        }

        if (!$this->scope->has('domain')) {
            return $node;
        }

        if ($node instanceof FilterExpression && 'trans' === $node->getNode('filter')->getAttribute('value')) {
            $arguments = $node->getNode('arguments');
            if ($this->isNamedArguments($arguments)) {
                if (!$arguments->hasNode('domain') && !$arguments->hasNode(1)) {
                    
Home | Imprint | This part of the site doesn't use cookies.