How to use setData on Email and use it in template

Tags: #<Tag:0x00007f10c65d34b8>


Silverstripe Version:4.x

Question:How to use setData on Email and how to use two Dimensional Array in setData for template

What i want is a multi dimensional array in setData and use it in a template
for example, i want to iterate over ‘ticks’ how does that work?

$email = Email::create()
                'chart' => [
                    'ticks' => [200,150,100,50,0],
                    'values' => [45,30,95,12,45,56,76],
                    'filler' => [55,70,5,88,55,44,24],
                    'total' => 718


I’m a bit rusty on this but I think addData expects a regular array, but if you want to put arrays within that array and loop over them, you need to turn those deeper arrays in to ArrayData instances. Check out: