TypolinkSoftReferenceParser

class \TYPO3\CMS\Core\DataHandling\SoftReference\TypolinkSoftReferenceParser

Extends
AbstractSoftReferenceParser

TypoLink value processing.

Will process input value as a TypoLink value. References to page id or file, possibly with anchor/target, possibly commaseparated list.

Table of Contents

Properties

$eventDispatcher  : EventDispatcherInterface
$parameters  : array
$parserKey  : string
$tokenID_basePrefix  : string

Methods

__construct()  : mixed
getParserKey()  : string
Returns the parser key, which was previously set by "setParserKey"
makeTokenID()  : string
Make Token ID for input index.
parse()  : SoftReferenceParserResult
Main function through which can parse content for a specific field.
setParserKey()  : void
The two properties parserKey and parameters may be set to generate a unique token ID from them.
getTypoLinkParts()  : array
Analyze content as a TypoLink value and return an array with properties.
resolveRecordLinkTable()  : string
Resolves the database table of a record link (t3://record?identifier=...). The identifier is mapped to a table via the link handler configuration of the page TSconfig of the referencing record, otherwise the identifier is used as table name (behaviour before the mapping existed).
setTokenIdBasePrefix()  : void
setTypoLinkPartsElement()  : string
Recompile a TypoLink value from the array of properties made with getTypoLinkParts() into an elements array

Properties

$eventDispatcher

protected EventDispatcherInterface $eventDispatcher

$parameters

protected array $parameters = []

$parserKey

protected string $parserKey = ''

$tokenID_basePrefix

protected string $tokenID_basePrefix = ''

Methods

__construct()

public __construct(EventDispatcherInterface $eventDispatcher) : mixed

Parameters

$eventDispatcher : EventDispatcherInterface

getParserKey()

Returns the parser key, which was previously set by "setParserKey"

public getParserKey() : string

Return values

string

makeTokenID()

Make Token ID for input index.

public makeTokenID([string $index = '' ]) : string

Parameters

$index : string = ''

Suffix value.

Return values

string —

Token ID

parse()

Main function through which can parse content for a specific field.

public parse(string $table, string $field, int $uid, string $content[, string $structurePath = '' ]) : SoftReferenceParserResult

Parameters

$table : string

Database table name

$field : string

Field name for which processing occurs

$uid : int

UID of the record

$content : string

The content/value of the field

$structurePath : string = ''

If running from inside a FlexForm structure, this is the path of the tag.

Return values

SoftReferenceParserResult —

Result object on positive matches, see description above.

setParserKey()

The two properties parserKey and parameters may be set to generate a unique token ID from them.

public setParserKey(string $parserKey, array $parameters) : void

Parameters

$parserKey : string

The softref parser key.

$parameters : array

Parameters of the softlink parser. Basically this is the content inside optional []-brackets after the softref keys. Parameters are exploded by ";

getTypoLinkParts()

Analyze content as a TypoLink value and return an array with properties.

protected getTypoLinkParts(string $typolinkValue, string $referenceTable, int $referenceUid) : array

TypoLinks format is: <link [typolink] [browser target] [css class] [title attribute] [additionalParams]>. See TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::typolink() The syntax of the [typolink] part is: [typolink] = [page id][,[type value]][#[anchor, if integer = tt_content uid]] The extraction is based on how \TYPO3\CMS\Frontend\ContentObject::typolink() behaves.

Parameters

$typolinkValue : string

TypoLink value.

$referenceTable : string

The reference table

$referenceUid : int

The UID of the reference record

Tags

see
ContentObjectRenderer::typolink()
see
setTypoLinkPartsElement()

Return values

array —

Array with the properties of the input link specified. The key "type" will reveal the type. If that is blank it could not be determined.

resolveRecordLinkTable()

Resolves the database table of a record link (t3://record?identifier=...). The identifier is mapped to a table via the link handler configuration of the page TSconfig of the referencing record, otherwise the identifier is used as table name (behaviour before the mapping existed).

protected resolveRecordLinkTable(string $identifier, string $referenceTable, int $referenceUid) : string

Parameters

$identifier : string
$referenceTable : string
$referenceUid : int

Return values

string

setTokenIdBasePrefix()

protected setTokenIdBasePrefix(string $table, string $uid, string $field, string $structurePath) : void

Parameters

$table : string
$uid : string
$field : string
$structurePath : string

setTypoLinkPartsElement()

Recompile a TypoLink value from the array of properties made with getTypoLinkParts() into an elements array

protected setTypoLinkPartsElement(array $tLP, array &$elements, string $content, int $idx) : string

Parameters

$tLP : array

TypoLink properties

$elements : array

Array of elements to be modified with substitution / information entries.

$content : string

The content to process.

$idx : int

Index value of the found element - user to make unique but stable tokenID

Tags

see
getTypoLinkParts()

Return values

string —

The input content, possibly containing tokens now according to the added substitution entries in $elements

On this page