* * ``` * * @see https://docs.typo3.org/permalink/t3viewhelper:typo3-core-normalizedurl * @internal */ final class NormalizedUrlViewHelper extends AbstractViewHelper { public function __construct( private readonly SystemResourceFactory $systemResourceFactory, private readonly SystemResourcePublisherInterface $resourcePublisher, ) {} public function initializeArguments(): void { $this->registerArgument('pathOrUrl', 'string', 'Absolute path to file using EXT: syntax or URL.'); } /** * Output what is given as URL or extension relative path as absolute URL */ public function render(): string { $pathOrUrl = $this->renderChildren(); $resource = $this->systemResourceFactory->createPublicResource($pathOrUrl); return (string)$this->resourcePublisher->generateUri( $resource, $this->renderingContext->hasAttribute(ServerRequestInterface::class) ? $this->renderingContext->getAttribute(ServerRequestInterface::class) : null, new UriGenerationOptions(absoluteUri: true), ); } /** * Explicitly set argument name to be used as content. */ public function getContentArgumentName(): string { return 'pathOrUrl'; } }