TypoScriptService

class \TYPO3\CMS\Core\TypoScript\TypoScriptService

Utilities to manage and convert TypoScript Also contains the functionality in TypoScript called "optionSplit"

Table of Contents

Methods

convertPlainArrayToTypoScriptArray()  : array
Returns an array with Typoscript the old way (with dot).
convertTypoScriptArrayToPlainArray()  : array
Removes all trailing dots recursively from TS settings array
explodeConfigurationForOptionSplit()  : array
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 $plainArray) : array

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

A TypoScript Array with Extbase Syntax (without dot but with _typoScriptNodeValue)

Return values

array —

Array with TypoScript as usual (with dot)

convertTypoScriptArrayToPlainArray()

Removes all trailing dots recursively from TS settings array

public convertTypoScriptArrayToPlainArray(array $typoScriptArray) : array

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

The TypoScript array (e.g. array('foo' => 'TEXT', 'foo.' => array('bar' => 'baz')))

Return values

array —

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 $originalConfiguration, int $splitCount) : array

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

A TypoScript array

$splitCount : int

The number of items for which to generated individual TypoScript arrays

Return values

array —

The individualized TypoScript array.

On this page