Skip to content

Commit

Permalink
[Backport 12.4] Prefer LinkFactory::createUri() for pure URI creation (
Browse files Browse the repository at this point in the history
…#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 <mbrodala@pagemachine.de>
  • Loading branch information
github-actions[bot] and mbrodala authored Oct 5, 2024
1 parent 66a1f12 commit f0eaa89
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions Documentation/ColumnsConfig/Type/Link/_Snippets/_SomeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

0 comments on commit f0eaa89

Please sign in to comment.