registerArgument('as', 'string', 'Name of the registered render function', false, 'renderFunc'); $this->registerArgument( 'subjectName', 'string', 'Name of the argument passed to render function', false, 'subject' ); } public function compile( $argumentsName, $closureName, &$initializationPhpCode, ViewHelperNode $node, TemplateCompiler $compiler ) { // we disable compiling, because we will need access to the AST, which is not available if compiled // a cool improvement would be to drop the need to the AST and so become compilable $compiler->disable(); return "''"; } public function render(): string { $transferNode = new RootNode(); foreach ($this->childNodes as $childNode) { $transferNode->addChildNode($childNode); } $renderer = new NodeRenderTransfer($transferNode, $this->arguments['subjectName']); $this->renderingContext->getViewHelperVariableContainer() ->add(static::class, $this->arguments['as'], $renderer); return ''; } }