public function createNode(): Node
    {
        //Content of node to be imported
        $node = $this->compiler->createNode($this->path, $this->token);

        //Let's register user defined blocks (context and attributes) as placeholders
        $node->mountBlock(
            self::CONTEXT_BLOCK,
            [],
            [$this->createPlaceholder(self::CONTEXT_BLOCK, $contextID)],
            true
        );

        foreach ($this->token[HtmlTokenizer::TOKEN_ATTRIBUTES] as $attribute => $value) {
            //Attributes counted as blocks to replace elements in included node
            $node->mountBlock($attribute, [], [$value], true);
        }

        //We now have to compile node content to pass it's body to parent node
        $content = $node->compile($dynamic);

        //Outer blocks (usually user attributes) can be exported to template using non default
        //rendering technique, for example every "extra" attribute can be passed to specific
        //template location. Stempler to decide.
        foreach ($this->compiler->getExports() as $exporter) {
            /** @var array $dynamic */
            $content = $exporter->mountBlocks($content, $dynamic);
        }

        //Let's parse complied content without any imports (to prevent collision)
        $compiler = clone $this->compiler;

        //Outer content must be protected using unique names
        $rebuilt = new Node($compiler, $compiler->generateID(), $content);

        if (!empty($contextBlock = $rebuilt->findNode($contextID))) {
            //Now we can mount our content block
            $contextBlock->mountNode($this->contextNode());
        }

        return $rebuilt;
    }
public function createNode(): Node
    {
        //Content of node to be imported
        $node = $this->compiler->createNode($this->path, $this->token);

        //Let's register user defined blocks (context and attributes) as placeholders
        $node->mountBlock(
            self::CONTEXT_BLOCK,
            [],
            [$this->createPlaceholder(self::CONTEXT_BLOCK, $contextID)],
            true
        );

        foreach ($this->token[HtmlTokenizer::TOKEN_ATTRIBUTES] as $attribute => $value) {
            //Attributes counted as blocks to replace elements in included node
            $node->mountBlock($attribute, [], [$value], true);
        }

        //We now have to compile node content to pass it's body to parent node
        $content = $node->compile($dynamic);

        //Outer blocks (usually user attributes) can be exported to template using non default
        //rendering technique, for example every "extra" attribute can be passed to specific
        //template location. Stempler to decide.
        foreach ($this->compiler->getExports() as $exporter) {
            /** @var array $dynamic */
            $content = $exporter->mountBlocks($content, $dynamic);
        }

        //Let's parse complied content without any imports (to prevent collision)
        $compiler = clone $this->compiler;

        //Outer content must be protected using unique names
        $rebuilt = new Node($compiler, $compiler->generateID(), $content);

        if (!empty($contextBlock = $rebuilt->findNode($contextID))) {
            //Now we can mount our content block
            $contextBlock->mountNode($this->contextNode());
        }

        return $rebuilt;
    }
public function createNode ( ) : Node { //Content of node to be imported $ node = $ this -> compiler -> createNode ( $ this -> path , $ this -> token ) ; //Let's register user defined blocks (context and attributes) as placeholders $ node -> mountBlock ( self :: CONTEXT_BLOCK , [ ] , [ $ this -> createPlaceholder ( self :: CONTEXT_BLOCK , $ contextID ) ] , true ) ; foreach ( $ this -> token [ HtmlTokenizer :: TOKEN_ATTRIBUTES ] as $ attribute => $ value ) { //Attributes counted as blocks to replace elements in included node $ node -> mountBlock ( $ attribute , [ ] , [ $ value ] , true ) ; } //We now have to compile node content to pass it's body to parent node $ content = $ node -> compile ( $ dynamic ) ; //Outer blocks (usually user attributes) can be exported to template using non default //rendering technique, for example every "extra" attribute can be passed to specific //template location. Stempler to decide. foreach ( $ this -> compiler -> getExports ( ) as $ exporter ) { /** @var array $dynamic */ $ content = $ exporter -> mountBlocks ( $ content , $ dynamic ) ; } //Let's parse complied content without any imports (to prevent collision) $ compiler = clone $ this -> compiler ; //Outer content must be protected using unique names $ rebuilt = new Node ( $ compiler , $ compiler -> generateID ( ) , $ content ) ; if ( ! empty ( $ contextBlock = $ rebuilt -> findNode ( $ contextID ) ) ) { //Now we can mount our content block $ contextBlock -> mountNode ( $ this -> contextNode ( ) ) ; } return $ rebuilt ; }
Create node to be injected into template at place of tag caused import.

@return Node
Create node to be injected into template at place of tag caused import .