‪TYPO3CMS  10.4
TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder Class Reference
Inheritance diagram for TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder:
TYPO3\CMS\Frontend\Typolink\DatabaseRecordLinkBuilder TYPO3\CMS\Frontend\Typolink\EmailLinkBuilder TYPO3\CMS\Frontend\Typolink\ExternalUrlLinkBuilder TYPO3\CMS\Frontend\Typolink\FileOrFolderLinkBuilder TYPO3\CMS\Frontend\Typolink\LegacyLinkBuilder TYPO3\CMS\Frontend\Typolink\PageLinkBuilder TYPO3\CMS\Frontend\Typolink\TelephoneLinkBuilder

Public Member Functions

 __construct (ContentObjectRenderer $contentObjectRenderer, TypoScriptFrontendController $typoScriptFrontendController=null)
 
array build (array &$linkDetails, string $linkText, string $target, array $conf)
 
TypoScriptFrontendController getTypoScriptFrontendController ()
 

Protected Member Functions

string forceAbsoluteUrl (string $url, array $configuration)
 
bool isLibParseFuncDefined ()
 
string parseFallbackLinkTextIfLinkTextIsEmpty (string $originalLinkText, string $fallbackLinkText)
 
string encodeFallbackLinkTextIfLinkTextIsEmpty (string $originalLinkText, string $fallbackLinkText)
 
string resolveTargetAttribute (array $conf, string $name, bool $respectFrameSetOption=false, string $fallbackTarget='')
 
string null processUrl (string $context, string $url, array $typolinkConfiguration=[])
 

Protected Attributes

ContentObjectRenderer $contentObjectRenderer
 
TypoScriptFrontendController null $typoScriptFrontendController
 

Detailed Description

Abstract class to provide proper helper for most types necessary Hands in the ContentObject and TSFE which are needed here for all the stdWrap magic.

Definition at line 39 of file AbstractTypolinkBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder::__construct ( ContentObjectRenderer  $contentObjectRenderer,
TypoScriptFrontendController  $typoScriptFrontendController = null 
)

AbstractTypolinkBuilder constructor.

Parameters
ContentObjectRenderer$contentObjectRenderer
TypoScriptFrontendController$typoScriptFrontendController

Definition at line 55 of file AbstractTypolinkBuilder.php.

References TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder\$contentObjectRenderer, $GLOBALS, and TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder\$typoScriptFrontendController.

Member Function Documentation

◆ build()

array TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder::build ( array &  $linkDetails,
string  $linkText,
string  $target,
array  $conf 
)
abstract

Should be implemented by all subclasses to return an array with three parts:

  • ‪URL
  • ‪Link Text (can be modified)
  • ‪Target (can be modified)
Parameters
array$linkDetails‪parsed link details by the LinkService
string$linkText‪the link text
string$target‪the target to point to
array$conf‪the TypoLink configuration array
Returns
‪array an array with three parts (URL, Link Text, Target)

Reimplemented in TYPO3\CMS\Frontend\Typolink\PageLinkBuilder, TYPO3\CMS\Frontend\Typolink\DatabaseRecordLinkBuilder, TYPO3\CMS\Frontend\Typolink\FileOrFolderLinkBuilder, TYPO3\CMS\Frontend\Typolink\LegacyLinkBuilder, TYPO3\CMS\Frontend\Typolink\ExternalUrlLinkBuilder, TYPO3\CMS\Frontend\Typolink\EmailLinkBuilder, and TYPO3\CMS\Frontend\Typolink\TelephoneLinkBuilder.

◆ encodeFallbackLinkTextIfLinkTextIsEmpty()

string TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder::encodeFallbackLinkTextIfLinkTextIsEmpty ( string  $originalLinkText,
string  $fallbackLinkText 
)
protected

Helper method to a fallback method properly encoding HTML.

Parameters
string$originalLinkText‪the original string, if empty, the fallback link text
string$fallbackLinkText‪the string to be used.
Returns
‪string the final text

Definition at line 164 of file AbstractTypolinkBuilder.php.

Referenced by TYPO3\CMS\Frontend\Typolink\ExternalUrlLinkBuilder\build(), TYPO3\CMS\Frontend\Typolink\LegacyLinkBuilder\build(), TYPO3\CMS\Frontend\Typolink\FileOrFolderLinkBuilder\build(), and TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder\parseFallbackLinkTextIfLinkTextIsEmpty().

◆ forceAbsoluteUrl()

string TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder::forceAbsoluteUrl ( string  $url,
array  $configuration 
)
protected

Forces a given URL to be absolute.

Parameters
string$url‪The URL to be forced to be absolute
array$configuration‪TypoScript configuration of typolink
Returns
‪string The absolute URL

Definition at line 82 of file AbstractTypolinkBuilder.php.

References TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder\getTypoScriptFrontendController().

Referenced by TYPO3\CMS\Frontend\Typolink\FileOrFolderLinkBuilder\build(), TYPO3\CMS\Frontend\Typolink\LegacyLinkBuilder\build(), and TYPO3\CMS\Frontend\Typolink\PageLinkBuilder\build().

◆ getTypoScriptFrontendController()

◆ isLibParseFuncDefined()

bool TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder::isLibParseFuncDefined ( )
protected

Determines whether lib.parseFunc is defined.

Returns
‪bool

Definition at line 129 of file AbstractTypolinkBuilder.php.

Referenced by TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder\parseFallbackLinkTextIfLinkTextIsEmpty().

◆ parseFallbackLinkTextIfLinkTextIsEmpty()

string TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder::parseFallbackLinkTextIfLinkTextIsEmpty ( string  $originalLinkText,
string  $fallbackLinkText 
)
protected

Helper method to a fallback method parsing HTML out of it

Parameters
string$originalLinkText‪the original string, if empty, the fallback link text
string$fallbackLinkText‪the string to be used.
Returns
‪string the final text

Definition at line 145 of file AbstractTypolinkBuilder.php.

References TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder\encodeFallbackLinkTextIfLinkTextIsEmpty(), and TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder\isLibParseFuncDefined().

Referenced by TYPO3\CMS\Frontend\Typolink\PageLinkBuilder\build().

◆ processUrl()

string null TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder::processUrl ( string  $context,
string  $url,
array  $typolinkConfiguration = [] 
)
protected

Loops over all configured URL modifier hooks (if available) and returns the generated URL or NULL if no URL was generated.

Parameters
string$context‪The context in which the method is called (e.g. typoLink).
string$url‪The URL that should be processed.
array$typolinkConfiguration‪The current link configuration array.
Returns
‪string|null Returns NULL if URL was not processed or the processed URL as a string.
Exceptions

Definition at line 209 of file AbstractTypolinkBuilder.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Frontend\Typolink\ExternalUrlLinkBuilder\build(), TYPO3\CMS\Frontend\Typolink\LegacyLinkBuilder\build(), and TYPO3\CMS\Frontend\Typolink\FileOrFolderLinkBuilder\build().

◆ resolveTargetAttribute()

string TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder::resolveTargetAttribute ( array  $conf,
string  $name,
bool  $respectFrameSetOption = false,
string  $fallbackTarget = '' 
)
protected

Creates the value for target="..." in a typolink configuration

Parameters
array$conf‪the typolink configuration
string$name‪the key, usually "target", "extTarget" or "fileTarget"
bool$respectFrameSetOption‪if set, then the fallback is only used as target if the doctype allows it
string$fallbackTarget‪the string to be used when no target is found in the configuration
Returns
‪string the value of the target attribute, if there is one

Definition at line 181 of file AbstractTypolinkBuilder.php.

References TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder\getTypoScriptFrontendController().

Referenced by TYPO3\CMS\Frontend\Typolink\ExternalUrlLinkBuilder\build(), TYPO3\CMS\Frontend\Typolink\FileOrFolderLinkBuilder\build(), TYPO3\CMS\Frontend\Typolink\LegacyLinkBuilder\build(), and TYPO3\CMS\Frontend\Typolink\PageLinkBuilder\build().

Member Data Documentation

◆ $contentObjectRenderer

ContentObjectRenderer TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder::$contentObjectRenderer
protected

◆ $typoScriptFrontendController

TypoScriptFrontendController null TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder::$typoScriptFrontendController
protected