SoftReferenceParserResult

final class \TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult

The result object has two properties: "content" and matched elements.

content: Is a string containing the input content but possibly with tokens inside. Tokens are strings like {softref:[tokenID]}, which is a placeholder for a value extracted by a softref parser. For each token there MUST be an entry in the "elements" key, which has a "subst" key defining the tokenID and the tokenValue. See below.

matched elements: is an array where the keys are insignificant, but the values are arrays with these keys: "matchString" => // The value of the match. This is only for informational purposes to show what was found. "error" => // An error message can be set here, like "file not found" etc. "subst" => [ // If this array is found there MUST be a token in the output content as well! "tokenID" => // The tokenID string corresponding to the token in output content, {softref:[tokenID]}. This is typically an md5 hash of a string defining uniquely the position of the element. "tokenValue" => // The value that the token substitutes in the text. Basically, if this value is inserted instead of the token the content should match what was inputted originally. "type" => // file / db / string = the type of substitution. "file" means it is a relative file [automatically mapped], "db" means a database record reference [automatically mapped], "string" means it is manually modified string content (eg. an email address) "relFileName" => // (for "file" type): Relative filename. May not necessarily exist. This could be noticed in the error key. "recordRef" => // (for "db" type) : Reference to DB record on the form [table]:[uid]. May not necessarily exist. "title" => // Title of element (for backend information) "description" => // Description of element (for backend information) ]

Table of Contents

Methods

create()  : self
createWithoutMatches()  : self
getContent()  : string
getMatchedElements()  : array
hasContent()  : bool
hasMatched()  : bool

Methods

create()

public static create(string $content, array $elements) : self

Parameters

$content : string
$elements : array

Return values

self

createWithoutMatches()

public static createWithoutMatches() : self

Return values

self

getContent()

public getContent() : string

Return values

string

getMatchedElements()

public getMatchedElements() : array

Return values

array

hasContent()

public hasContent() : bool

Return values

bool

hasMatched()

public hasMatched() : bool

Return values

bool
On this page