From 6737a027bf6caf198a79606f30f64e5555fd574f Mon Sep 17 00:00:00 2001 From: Mathias Brodala Date: Sat, 5 Oct 2024 14:03:12 +0200 Subject: [PATCH] Prefer LinkFactory::createUri() for pure URI creation (#1167) * [TASK] Prefer LinkFactory::createUri() for pure URI creation The given example does not make much sense if nothing besides the URL/URI is used from a link * [BUGFIX] Properly invoke LinkFactory::createUri() --- .../Type/Link/_Snippets/_SomeService.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Documentation/ColumnsConfig/Type/Link/_Snippets/_SomeService.php b/Documentation/ColumnsConfig/Type/Link/_Snippets/_SomeService.php index 1ba39478..f2221e17 100644 --- a/Documentation/ColumnsConfig/Type/Link/_Snippets/_SomeService.php +++ b/Documentation/ColumnsConfig/Type/Link/_Snippets/_SomeService.php @@ -11,16 +11,11 @@ public function __construct( private readonly LinkFactory $linkFactory, ) {} - public function getLink(string $tcaLinkValue, ContentObjectRenderer $contentObjectRenderer): string + public function getUri(string $tcaLinkValue, ContentObjectRenderer $contentObjectRenderer): string { - $link = $this->linkFactory->create( - '', - [ - 'parameter' => $tcaLinkValue, - 'forceAbsoluteUrl' => true, - ], + return $this->linkFactory->createUri( + $tcaLinkValue, $contentObjectRenderer ); - return $link->getUrl(); } }