TypoScriptService
Utilities to manage and convert TypoScript Also contains the functionality in TypoScript called "optionSplit"
Table of Contents
Methods
- convertPlainArrayToTypoScriptArray() : array<string|int, mixed>
- Returns an array with Typoscript the old way (with dot).
- convertTypoScriptArrayToPlainArray() : array<string|int, mixed>
- Removes all trailing dots recursively from TS settings array
- explodeConfigurationForOptionSplit() : array<string|int, mixed>
- Implementation of the "optionSplit" feature in TypoScript (used eg. for MENU objects) What it does is to split the incoming TypoScript array so that the values are exploded by certain strings ("||" and "|*|") and each part distributed into individual TypoScript arrays with a similar structure, but individualized values.
Methods
convertPlainArrayToTypoScriptArray()
Returns an array with Typoscript the old way (with dot).
public
convertPlainArrayToTypoScriptArray(array<string|int, mixed> $plainArray) : array<string|int, mixed>
Extbase converts the "classical" TypoScript (with trailing dot) to a format without trailing dot, to be more future-proof and not to have any conflicts with Fluid object accessor syntax. However, if you want to call legacy TypoScript objects, you somehow need the "old" syntax (because this is what TYPO3 is used to). With this method, you can convert the extbase TypoScript to classical TYPO3 TypoScript which is understood by the rest of TYPO3.
Parameters
- $plainArray : array<string|int, mixed>
-
A TypoScript Array with Extbase Syntax (without dot but with _typoScriptNodeValue)
Return values
array<string|int, mixed> —Array with TypoScript as usual (with dot)
convertTypoScriptArrayToPlainArray()
Removes all trailing dots recursively from TS settings array
public
convertTypoScriptArrayToPlainArray(array<string|int, mixed> $typoScriptArray) : array<string|int, mixed>
Extbase converts the "classical" TypoScript (with trailing dot) to a format without trailing dot, to be more future-proof and not to have any conflicts with Fluid object accessor syntax.
Parameters
- $typoScriptArray : array<string|int, mixed>
-
The TypoScript array (e.g. array('foo' => 'TEXT', 'foo.' => array('bar' => 'baz')))
Return values
array<string|int, mixed> —e.g. array('foo' => array('_typoScriptNodeValue' => 'TEXT', 'bar' => 'baz'))
explodeConfigurationForOptionSplit()
Implementation of the "optionSplit" feature in TypoScript (used eg. for MENU objects) What it does is to split the incoming TypoScript array so that the values are exploded by certain strings ("||" and "|*|") and each part distributed into individual TypoScript arrays with a similar structure, but individualized values.
public
explodeConfigurationForOptionSplit(array<string|int, mixed> $originalConfiguration, int $splitCount) : array<string|int, mixed>
The concept is known as "optionSplit" and is rather advanced to handle but quite powerful, in particular for creating menus in TYPO3.
Parameters
- $originalConfiguration : array<string|int, mixed>
-
A TypoScript array
- $splitCount : int
-
The number of items for which to generated individual TypoScript arrays
Return values
array<string|int, mixed> —The individualized TypoScript array.