TypoScriptService

Helper class to manage and convert TypoScript into differently shaped arrays.

Also contains the functionality in TypoScript called "optionSplit".

Internal

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)

Internal

Avoid using this method. This has been invented for Extbase, which decided to move TypoScript arrays around in just another different way.

Tags
todo:

Usages should be removed mid-term to work on the TypoScript object tree directly.

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>

for example ['foo' => 'TEXT', 'foo.' => ['bar' => 'baz']]

Internal

Avoid using this method. This has been invented for Extbase, which decided to move TypoScript arrays around in just another different way.

Tags
todo:

Usages should be removed mid-term to work on the TypoScript object tree directly.

Return values
array<string|int, mixed>

for example ['foo' => ['_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 generate individual TypoScript arrays

Tags
todo:

This method is a sign of bad abstraction. It should be modelled differently and located elsewhere.

Return values
array<string|int, mixed>

The individualized TypoScript array.


        
On this page

Search results