DatabaseRecordLinkBuilder extends AbstractTypolinkBuilder
Builds a TypoLink to a database record
Table of Contents
Properties
- $contentObjectRenderer : ContentObjectRenderer
- $typoScriptFrontendController : TypoScriptFrontendController|null
Methods
- __construct() : mixed
- build() : LinkResultInterface
- Should be implemented by all subclasses to return an array with three parts: - URL - Link Text (can be modified) - Target (can be modified) - Tag Attributes (optional)
- encodeFallbackLinkTextIfLinkTextIsEmpty() : string
- Helper method to a fallback method properly encoding HTML.
- forceAbsoluteUrl() : string
- Forces a given URL to be absolute.
- getPageTsConfig() : array<string|int, mixed>
- Helper method to calculate pageTsConfig in frontend scope, we can't use BackendUtility::getPagesTSconfig() here.
- getTypoScriptFrontendController() : TypoScriptFrontendController
- isLibParseFuncDefined() : bool
- Determines whether lib.parseFunc is defined.
- parseFallbackLinkTextIfLinkTextIsEmpty() : string
- Helper method to a fallback method parsing HTML out of it
- resolveTargetAttribute() : string
- Creates the value for target="..." in a typolink configuration
Properties
$contentObjectRenderer
protected
ContentObjectRenderer
$contentObjectRenderer
$typoScriptFrontendController
protected
TypoScriptFrontendController|null
$typoScriptFrontendController
= null
Methods
__construct()
public
__construct(ContentObjectRenderer $contentObjectRenderer[, TypoScriptFrontendController|null $typoScriptFrontendController = null ]) : mixed
Parameters
- $contentObjectRenderer : ContentObjectRenderer
- $typoScriptFrontendController : TypoScriptFrontendController|null = null
build()
Should be implemented by all subclasses to return an array with three parts: - URL - Link Text (can be modified) - Target (can be modified) - Tag Attributes (optional)
public
build(array<string|int, mixed> &$linkDetails, string $linkText, string $target, array<string|int, mixed> $conf) : LinkResultInterface
Parameters
- $linkDetails : array<string|int, mixed>
-
parsed link details by the LinkService
- $linkText : string
-
the link text
- $target : string
-
the target to point to
- $conf : array<string|int, mixed>
-
the TypoLink configuration array
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) : string
Parameters
- $url : string
-
The URL to be forced to be absolute
- $configuration : array<string|int, mixed>
-
TypoScript configuration of typolink
Return values
string —The absolute URL
getPageTsConfig()
Helper method to calculate pageTsConfig in frontend scope, we can't use BackendUtility::getPagesTSconfig() here.
protected
getPageTsConfig(ServerRequestInterface $request) : array<string|int, mixed>
Parameters
- $request : ServerRequestInterface
Return values
array<string|int, mixed>getTypoScriptFrontendController()
protected
getTypoScriptFrontendController() : TypoScriptFrontendController
Return values
TypoScriptFrontendControllerisLibParseFuncDefined()
Determines whether lib.parseFunc is defined.
protected
isLibParseFuncDefined() : bool
Return values
boolparseFallbackLinkTextIfLinkTextIsEmpty()
Helper method to a fallback method parsing HTML out of it
protected
parseFallbackLinkTextIfLinkTextIsEmpty(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
resolveTargetAttribute()
Creates the value for target="..." in a typolink configuration
protected
resolveTargetAttribute(array<string|int, mixed> $conf, string $name) : string
Parameters
- $conf : array<string|int, mixed>
-
the typolink configuration
- $name : string
-
the key, usually "target", "extTarget" or "fileTarget"
Return values
string —the value of the target attribute, if there is one