some value * {oldvariable -> f:format.htmlspecialchars() -> f:variable(name: 'newvariable')} * {oldvariable} * * @see \TYPO3Fluid\Fluid\ViewHelpers\IfViewHelper * @api */ class ReplaceViewHelper extends AbstractViewHelper { use CompileWithContentArgumentAndRenderStatic; public function initializeArguments(): void { $this->registerArgument('value', 'string', 'String to replace in'); $this->registerArgument('search', 'string', 'Search string'); $this->registerArgument('replace', 'string', 'Replace value'); } public static function renderStatic( array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext ): string { $content = $arguments['value']; if ($content === null) { $content = $renderChildrenClosure(); } return str_replace($arguments['search'], $arguments['replace'], $content); } }