2
votes

In the TypoScript Reference, the data type for some properties is defined as "array" or "array of ... with stdWrap" or something similar.

In the list of data types in the TSRef however, "array" is nowhere to be found.

I know, essentially it really is an array when converted to PHP, but what does data type array mean exactly in this context?

2

2 Answers

2
votes

There are further arrays (like array of cObjects for subparts and marks in templates)

They all define another level of elements in your typoscript. The kind of array may give you a hint what index and what kind of values are expected.

Sometimes the index is ordered for evaluation (e.g. COA, layoutRootPaths), sometimes it does not matter (e.g. marks, subparts) or are evaluated in the order of the typoscript (e.g. includeJS). As you could have multiple kinds of array in PHP each can be evaluated in multiple ways.

The kind of values (in the documentation) depend on the further evaluation. Simple integer, strings, cObjects, ...
Not everywhere you are able to add stdWrap functions (so values evaluated in the core should have it).

As you already mentioned: typoscript is scanned and stored as multidimensional array.
Each part of (core-)code evaluates this array with an individual logic. So the interpretation of an array is done individually.

And until now there is no full consens about which kind of arrays are representative or typical to be an own type. An unification would probably need code changes, in core and in multiple extensions. For optimization of the manuals you should open a forge ticket requesting an explanation in the manuals with the kind of arrays you found.

1
votes

The docs are kind of confusing in that regard, because there are no "arrays" in TypoScript at all, because TypoScript isn't even a programming language. TypoScript is just a configuration, like YAML or JSON and will be converted into an array itself by PHP. I think it should rather be called "a list of things" instead of "an array of things", but since arrays are kinda lists themselfes and developers, who are the main audience of the docs, should know what the docs are talking about when talking about "an array of things", it is kinda valid to leave it as is.