ExternalUrlLinkBuilder extends AbstractTypolinkBuilder implements TypolinkBuilderInterface
Builds a TypoLink to an external URL
Table of Contents
Interfaces
- TypolinkBuilderInterface
- Used to generate a link to a page or file, an external URL or any other protocol in the frontend or backend.
Properties
Methods
- _build() : LinkResultInterface
- This method is only here to keep BC for the build() method which will be removed in TYPO3 v15.0.
- buildLink() : LinkResultInterface
- encodeFallbackLinkTextIfLinkTextIsEmpty() : string
- Helper method to a fallback method properly encoding HTML.
- forceAbsoluteUrl() : string
- Forces a given URL to be absolute.
- getAbsRefPrefix() : string
- resolveTargetAttribute() : string
- Creates the value for target="..." in a typolink configuration
Properties
$contentObjectRenderer
this will be removed in TYPO3 v15.0. The ContentObjectRenderer will be passed to the buildLink() method of TypolinkBuilderInterface via the PSR-7 Request attribute "currentContentObject" instead.
protected
ContentObjectRenderer
$contentObjectRenderer
Methods
_build()
This method is only here to keep BC for the build() method which will be removed in TYPO3 v15.0.
public
_build(array<string|int, mixed> &$linkDetails, string $linkText, string $target, array<string|int, mixed> $conf, ServerRequestInterface $request, ContentObjectRenderer $contentObjectRenderer) : LinkResultInterface
The actual implementation should be done in buildLink() instead.
Parameters
- $linkDetails : array<string|int, mixed>
- $linkText : string
- $target : string
- $conf : array<string|int, mixed>
- $request : ServerRequestInterface
- $contentObjectRenderer : ContentObjectRenderer
this method will be removed in TYPO3 v15.0 again.
Return values
LinkResultInterfacebuildLink()
public
buildLink(array<string|int, mixed> $linkDetails, array<string|int, mixed> $configuration, ServerRequestInterface $request[, string $linkText = '' ]) : LinkResultInterface
Parameters
- $linkDetails : array<string|int, mixed>
-
parsed link details by the LinkService
- $configuration : array<string|int, mixed>
-
the TypoLink configuration array
- $request : ServerRequestInterface
- $linkText : string = ''
-
the link text
Return values
LinkResultInterfaceencodeFallbackLinkTextIfLinkTextIsEmpty()
Helper method to a fallback method properly encoding HTML.
protected
encodeFallbackLinkTextIfLinkTextIsEmpty(string $originalLinkText, string $fallbackLinkText) : string
Parameters
- $originalLinkText : string
-
the original string, if empty, the fallback link text
- $fallbackLinkText : string
-
the string to be used.
Return values
string —the final text
forceAbsoluteUrl()
Forces a given URL to be absolute.
protected
forceAbsoluteUrl(string $url, array<string|int, mixed> $configuration[, ServerRequestInterface|null $request = null ]) : string
Parameters
- $url : string
-
The URL to be forced to be absolute
- $configuration : array<string|int, mixed>
-
TypoScript configuration of typolink
- $request : ServerRequestInterface|null = null
Return values
string —The absolute URL
getAbsRefPrefix()
protected
getAbsRefPrefix(ServerRequestInterface $request) : string
Parameters
- $request : ServerRequestInterface
Return values
stringresolveTargetAttribute()
Creates the value for target="..." in a typolink configuration
protected
resolveTargetAttribute(array<string|int, mixed> $conf, string $name[, ContentObjectRenderer|null $contentObjectRenderer = null ]) : string
Parameters
- $conf : array<string|int, mixed>
-
the typolink configuration
- $name : string
-
the key, usually "target", "extTarget" or "fileTarget"
- $contentObjectRenderer : ContentObjectRenderer|null = null
Return values
string —the value of the target attribute, if there is one