* ``` * * @internal this is not part of TYPO3 Core API. */ final class ClickEnlargeViewHelper extends AbstractViewHelper { /** * @var bool */ protected $escapeOutput = false; public function __construct( private readonly TypoScriptService $typoScriptService, ) {} public function initializeArguments(): void { $this->registerArgument('image', FileInterface::class, 'The original image file', true); $this->registerArgument( 'configuration', 'array', 'TypoScript properties for the "imageLinkWrap" function', true ); } public function render(): string { /** @var FileInterface $image */ $image = $this->arguments['image']; $request = $this->renderingContext->getAttribute(ServerRequestInterface::class); $contentObjectRenderer = GeneralUtility::makeInstance(ContentObjectRenderer::class); $contentObjectRenderer->setRequest($request); $contentObjectRenderer->start($request->getAttribute('frontend.page.information')->getPageRecord(), 'pages'); $contentObjectRenderer->setCurrentFile($image); $objDataBackup = null; if ($this->renderingContext->getVariableProvider()->exists('data')) { $objDataBackup = $contentObjectRenderer->data; $contentObjectRenderer->data = $this->renderingContext->getVariableProvider()->get('data'); } $configuration = $this->typoScriptService->convertPlainArrayToTypoScriptArray($this->arguments['configuration']); $content = $this->renderChildren(); $configuration['enable'] = true; $result = $contentObjectRenderer->imageLinkWrap((string)$content, $image, $configuration); if ($objDataBackup) { $contentObjectRenderer->data = $objDataBackup; } return $result; } }