Can somebody explain me this Typo3 TypoScript code?

Viewed 65

Can somebody explain me the following TypoScript code?

I think the most parameters are from stdWrap integrated in TEXT datatype. But esp. the data field is not explained in the TypoScript Ref also the assigned data "pagelayout" is not described and the parameters specified to split are incomprehensible for me.

It would be nice if you can explain me the details so I can realy understand what is going on here.

cObject = TEXT
cObject {
    data = pagelayout
    required = 1
    case = ucfirst
    split {
        token = pagets__
        cObjNum = 1
        1.current = 1
    }
}

TypoScript TEXT Reference

2 Answers

The solution is that the "pagelayout"variable holds the currently assigned Backend-Layout in the format of "pagets__LayoutName. The code above will split this string at the position of "pagets__" and uses the left over string "LayoutName" as the Filename for the Layout that has to be included..

A specific behaviour of stdWrap is that each function is executed in a certain order. So actually this is what happens:

data => https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/Functions/Stdwrap.html?highlight=stdwrap%20data#data

According to the docs it is of the type

getText => https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/Functions/Data.html#data-type-gettext

getText can provide

pagelayout => https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/Functions/Data.html?highlight=gettext#pagelayout

That value is required https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/Functions/Stdwrap.html#required

and then split once by the string pagets__ https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/Functions/Stdwrap.html#split

finally it will be converted to upper case first by case https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/Functions/Stdwrap.html#case

So the actual order would be

cObject = TEXT
cObject {
    data = pagelayout
    required = 1
    split {
        token = pagets__
        cObjNum = 1
        1.current = 1
    }
    case = ucfirst
}

And a string pagets_something will become Something as the final result.

Related