PageTsConfigParser
A TS-Config parsing class which performs condition evaluation.
since TYPO3 v12, will be removed with v13. Use PageTsConfigFactory instead. When removing, also remove entries in core Services.yaml.
This class does parsing of a compiled TSconfig string, and applies matching() based on the Context (FE or BE) in it, allowing to be fully agnostic to the outside world.
Table of Contents
Properties
Methods
- __construct() : mixed
- parse() : array<string|int, mixed>
- Parses and matches a given string Adds entries to the cache: - when an exact on the conditions are there - when a parse is there, then matches are happening anyway, and it is checked if this can be cached as well.
- matching() : array<string|int, mixed>
- Is just going through an array of conditions to determine which are matching (for getting correct cache entry)
- parseAndMatch() : array<string|int, mixed>
- Does the actual parsing using the TypoScriptParser "parse" method by applying a condition matcher.
Properties
$cache
protected
FrontendInterface
$cache
$typoScriptParser
protected
TypoScriptParser
$typoScriptParser
Methods
__construct()
public
__construct(TypoScriptParser $typoScriptParser, FrontendInterface $cache) : mixed
Parameters
- $typoScriptParser : TypoScriptParser
- $cache : FrontendInterface
parse()
Parses and matches a given string Adds entries to the cache: - when an exact on the conditions are there - when a parse is there, then matches are happening anyway, and it is checked if this can be cached as well.
public
parse(string $content, ConditionMatcherInterface $matcher[, Site|null $site = null ]) : array<string|int, mixed>
If a site is provided the settings stored in the site's configuration is available as constants for the TSconfig.
Parameters
- $content : string
-
page TSconfig, usually accumulated by the PageTsConfigLoader
- $matcher : ConditionMatcherInterface
-
an instance to match strings
- $site : Site|null = null
-
The current site the page TSconfig is parsed for
Return values
array<string|int, mixed> —the
matching()
Is just going through an array of conditions to determine which are matching (for getting correct cache entry)
protected
matching(array<string|int, mixed> $sectionsToMatch, ConditionMatcherInterface $matcher) : array<string|int, mixed>
Parameters
- $sectionsToMatch : array<string|int, mixed>
-
An array containing the sections to match
- $matcher : ConditionMatcherInterface
Return values
array<string|int, mixed> —The input array with matching sections to be filled into the "match" key
parseAndMatch()
Does the actual parsing using the TypoScriptParser "parse" method by applying a condition matcher.
protected
parseAndMatch(string $content, ConditionMatcherInterface $matcher) : array<string|int, mixed>
Parameters
- $content : string
-
The TSconfig being parsed
- $matcher : ConditionMatcherInterface
Return values
array<string|int, mixed> —Array containing the parsed TSconfig, the encountered sections, the matched sections. This is stored in cache.