Fluid icon indicating copy to clipboard operation
Fluid copied to clipboard

Document array and object property access

Open cweiske opened this issue 1 year ago • 2 comments

The "fluid syntax" documentation at https://docs.typo3.org/other/typo3fluid/fluid/main/en-us/Usage/Syntax.html does not talk about how to access array and object properties.

It should show the following cases, preferably with syntactically equivalent PHP code:

  • Accessing an array with a known key: myarrayvar.23 (php: $myarrayvar[23])
  • Accessing an object property with a known name: myobject.myproperty (php: $myobject->myproperty)
  • Accessing an array with the key in a variable: ??? (php: $myarrayvar[$mykeyname])
  • Accessing an object property with the property in a variable: ??? (php: $myobject->$myvarname)
  • Accessing getter/isset/has methods: myobject.foo (php: $myobject->getFoo())

cweiske avatar Oct 16 '24 06:10 cweiske

Fun fact: it is already documented here: https://github.com/TYPO3/Fluid/blob/3510df3031d978f3fb8128f973a9d70eddb99df8/examples/Resources/Private/Singles/Variables.html

So if you could open a PR to copy the necessary info to the officially rendered docs, that would be wonderful. :-)

mbrodala avatar Oct 16 '24 06:10 mbrodala

Yes, there are certainly some blind spots in the documentation we need to address. We will gladly accept PRs in this area.

s2b avatar Oct 16 '24 11:10 s2b