TypolinkSoftReferenceParser extends AbstractSoftReferenceParser uses PublicMethodDeprecationTrait
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
- __call() : mixed
- Checks if the method of the given name is available, calls it but throws a deprecation.
- __construct() : mixed
- findRef() : 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
__call()
Checks if the method of the given name is available, calls it but throws a deprecation.
public
__call(string $methodName, array<string|int, mixed> $arguments) : mixed
If the method does not exist, a fatal error is thrown.
Unavailable protected methods must return in a fatal error as usual. Marked methods are called and a deprecation entry is thrown.
__call() is not called for public methods.
Parameters
- $methodName : string
- $arguments : array<string|int, mixed>
__construct()
public
__construct(EventDispatcherInterface $eventDispatcher) : mixed
Parameters
- $eventDispatcher : EventDispatcherInterface
findRef()
public
findRef(string $table, string $field, int $uid, string $content, string $spKey, array<string|int, mixed> $spParams[, string $structurePath = '' ]) : mixed
Parameters
- $table : string
- $field : string
- $uid : int
- $content : string
- $spKey : string
- $spParams : array<string|int, mixed>
- $structurePath : string = ''
will be removed in favor of ->parse() in TYPO3 v12.0.
getParserKey()
Returns the parser key, which was previously set by "setParserKey"
public
getParserKey() : string
Return values
stringmakeTokenID()
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
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
Return values
string —The input content, possibly containing tokens now according to the added substitution entries in $elements