From f0eaa891d4fc589c34216a447bc09d886e161716 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 5 Oct 2024 14:29:25 +0200 Subject: [PATCH] [Backport 12.4] Prefer LinkFactory::createUri() for pure URI creation (#1181) * [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() --------- Co-authored-by: Mathias Brodala --- .../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(); } }