SoftReferenceIndex extends TypolinkSoftReferenceParser implements SingletonInterface
Class for processing of the default soft reference types for CMS:
will be removed in TYPO3 v12.0 in favor of SoftReferenceParserInterface
- 'substitute' : A full field value targeted for manual substitution (for import /export features)
- 'notify' : Just report if a value is found, nothing more.
- 'typolink' : references to page id or file, possibly with anchor/target, possibly commaseparated list.
- 'typolink_tag' : As typolink, but searching for tag to encapsulate it.
- 'email' : Email highlight
- 'url' : URL highlights (with a scheme)
Table of Contents
Interfaces
- SingletonInterface
- "empty" interface for singletons (marker interface pattern)
Properties
- $tokenID_basePrefix : string
- $eventDispatcher : EventDispatcherInterface
- $parameters : array<string|int, mixed>
- $parserKey : string
- $softReferenceParserFactory : SoftReferenceParserFactory
Methods
- __call() : mixed
- Checks if the method of the given name is available, calls it but throws a deprecation.
- __construct() : mixed
- findRef() : mixed
- findRef_email() : array<string|int, mixed>|null
- Finding email addresses in content and making them substitutable.
- findRef_extension_fileref() : array<string|int, mixed>|null
- Finding reference to files from extensions in content, but only to notify about their existence. No substitution
- findRef_typolink() : array<string|int, mixed>|null
- TypoLink value processing.
- findRef_typolink_tag() : array<string|int, mixed>|null
- TypoLink tag processing.
- findRef_url() : array<string|int, mixed>|null
- Finding URLs in content
- 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
$tokenID_basePrefix
public
string
$tokenID_basePrefix
$eventDispatcher
protected
EventDispatcherInterface
$eventDispatcher
$parameters
protected
array<string|int, mixed>
$parameters
= []
$parserKey
protected
string
$parserKey
= ''
$softReferenceParserFactory
protected
SoftReferenceParserFactory
$softReferenceParserFactory
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, SoftReferenceParserFactory $softReferenceParserFactory) : mixed
Parameters
- $eventDispatcher : EventDispatcherInterface
- $softReferenceParserFactory : SoftReferenceParserFactory
findRef()
public
findRef(mixed $table, mixed $field, mixed $uid, mixed $content, mixed $spKey, mixed $spParams[, mixed $structurePath = '' ]) : mixed
since v11, will be removed in v12
Parameters
- $table : mixed
- $field : mixed
- $uid : mixed
- $content : mixed
- $spKey : mixed
- $spParams : mixed
- $structurePath : mixed = ''
findRef_email()
Finding email addresses in content and making them substitutable.
public
findRef_email(string $content, array<string|int, mixed> $spParams) : array<string|int, mixed>|null
Parameters
- $content : string
-
The input content to analyze
- $spParams : array<string|int, mixed>
-
Parameters set for the softref parser key in TCA/columns
Return values
array<string|int, mixed>|null —Result array on positive matches, see description above. Otherwise null
findRef_extension_fileref()
Finding reference to files from extensions in content, but only to notify about their existence. No substitution
public
findRef_extension_fileref(string $content) : array<string|int, mixed>|null
Parameters
- $content : string
-
The input content to analyze
Return values
array<string|int, mixed>|null —Result array on positive matches, see description above. Otherwise null
findRef_typolink()
TypoLink value processing.
public
findRef_typolink(string $content, array<string|int, mixed> $spParams) : array<string|int, mixed>|null
Will process input value as a TypoLink value.
Parameters
- $content : string
-
The input content to analyze
- $spParams : array<string|int, mixed>
-
Parameters set for the softref parser key in TCA/columns. value "linkList" will split the string by comma before processing.
Tags
Return values
array<string|int, mixed>|null —Result array on positive matches, see description above. Otherwise null
findRef_typolink_tag()
TypoLink tag processing.
public
findRef_typolink_tag(string $content) : array<string|int, mixed>|null
Will search for <link ...> and tags in the content string and process any found.
Parameters
- $content : string
-
The input content to analyze
Tags
Return values
array<string|int, mixed>|null —Result array on positive matches, see description above. Otherwise null
findRef_url()
Finding URLs in content
public
findRef_url(string $content, array<string|int, mixed> $spParams) : array<string|int, mixed>|null
Parameters
- $content : string
-
The input content to analyze
- $spParams : array<string|int, mixed>
-
Parameters set for the softref parser key in TCA/columns
Return values
array<string|int, mixed>|null —Result array on positive matches, see description above. Otherwise null
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