I have a very deeply nested data structure and the variable names in my Twig template are getting quite long.
In Mustache, you can "delimit" the data using the {{# variable }}
and everything inside that you wouldn't have to "prefix" with that variable, like this:
data:
variable1
variable2
variable2_1
variable2_2
variable3
variable3_1
variable3_2
variable3_3
Mustache template:
{{# variable1}}
<element>{{variable2}}</element>
<element>{{variable3.variable3_3}}</element>
{{/ variable1}}
In the above, you don't have to prefix the variable2
and variable3.variable3_3
with variable1
.
Here's an example of one data element that I have:
ProcNoStsRq.ProcFold.Header.Admin.Sup.Pty.Contact.Comms.SA.Address.City
(note that this one is shortened from the 122 characters of the real variable name)
I know I'm going to have some that are even deeper. How can I achieve the same in Twig?