‪TYPO3CMS  ‪main
TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult Class Reference

Public Member Functions

 hasMatched ()
 hasContent ()
 getContent ()
 getMatchedElements ()

Static Public Member Functions

static create (string $content, array $elements)
static createWithoutMatches ()

Private Attributes

string $content = ''
array $elements = []
bool $hasMatched = false

Detailed Description

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) ]

Definition at line 42 of file SoftReferenceParserResult.php.

Member Function Documentation

◆ create()

◆ createWithoutMatches()

static TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult::createWithoutMatches ( )

◆ getContent()

TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult::getContent ( )

◆ getMatchedElements()

TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult::getMatchedElements ( )

◆ hasContent()

TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult::hasContent ( )

Definition at line 72 of file SoftReferenceParserResult.php.

◆ hasMatched()

TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult::hasMatched ( )

Member Data Documentation

◆ $content

string TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult::$content = ''

◆ $elements

array TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult::$elements = []

◆ $hasMatched

bool TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult::$hasMatched = false