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<string|int, mixed>
$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<string|int, mixed>
Analyze content as a TypoLink value and return an array with properties.
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<string|int, mixed> $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<string|int, mixed> $parameters) : void
Parameters
$parserKey : string

The softref parser key.

$parameters : array<string|int, mixed>

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<string|int, mixed>

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<string|int, mixed> —

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.

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<string|int, mixed> $tLP, array<string|int, mixed> &$elements, string $content, int $idx) : string
Parameters
$tLP : array<string|int, mixed>

TypoLink properties

$elements : array<string|int, mixed>

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

Search results