Skip to content

Commit

Permalink
Prefer LinkFactory::createUri() for pure URI creation (#1167)
Browse files Browse the repository at this point in the history
* [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()
  • Loading branch information
mbrodala authored Oct 5, 2024
1 parent 64b5ffa commit 6737a02
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 6737a02

Please sign in to comment.