Search code examples
typo3typoscripttypo3-11.x

Can somebody explain me this Typo3 TypoScript code?


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


Solution

  • 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.