/** * Custom implementation of compile method. Performns variable * provider overlaying, calls renderChildren and throws a * StopCompilingChildren with a static replacement string attached. * * TemplateCompiler then inserts this string as a static string in * the compiled template (and stops compiling all child nodes). * * @param string $argumentsName * @param string $closureName * @param string $initializationPhpCode * @param ViewHelperNode $node * @param TemplateCompiler $compiler */ public function compile($argumentsName, $closureName, &$initializationPhpCode, ViewHelperNode $node, TemplateCompiler $compiler) { $originalVariableProvider = static::overlayVariablesIfNotSet($this->renderingContext, $this->arguments); $stopCompilingChildrenException = new StopCompilingChildrenException(); $stopCompilingChildrenException->setReplacementString($this->renderChildren()); $this->renderingContext->setVariableProvider($originalVariableProvider); throw $stopCompilingChildrenException; }
/** * @param string $argumentsName * @param string $closureName * @param string $initializationPhpCode * @param ViewHelperNode $node * @param TemplateCompiler $compiler */ public function compile($argumentsName, $closureName, &$initializationPhpCode, ViewHelperNode $node, TemplateCompiler $compiler) { $renderedString = $node->evaluateChildNodes($this->renderingContext); $stopCompilingChildrenException = new StopCompilingChildrenException(); $stopCompilingChildrenException->setReplacementString($renderedString); throw $stopCompilingChildrenException; }