a kind of (limited) workaround is to use the array union operator (+ or +=) ) :
{{ the_array = [] }}
{{ loop from="0" to="2" }}
{{ key = index}}
{{ value = count }}
{{ the_array += value }}
{{ /loop }}
{{ the_array|dump }} {{# the_array is now filled #}}
I know the original PR mentions :
But apparently it's not only the empty square bracket syntax [] (= add a new item at the end)
but any square bracket syntax [x] which looks not supported
How to reproduce
please check bug description section
Logs
No response
Environment
Environment
Application Name: Statamic leporc
Laravel Version: 9.52.4
PHP Version: 8.1.14
Composer Version: 2.5.1
Environment: local
Debug Mode: ENABLED
URL: leporc.localhost
Maintenance Mode: OFF
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED
Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file
Statamic
Addons: 1
Antlers: runtime
Stache Watcher: Disabled
Static Caching: Disabled
Version: 3.4.5 PRO
Statamic Addons
statamic/seo-pro: 4.0.1
Bug description
thanks to this pr statamic/cms#7594 we can do that :
ie : we can create item by using the nested path syntax.
But we can't use the square bracket syntax to do that:
{{ the_array[2] = 'Three'; }}
And by extend we cant use dynamic key either :
output :
a kind of (limited) workaround is to use the array union operator (+ or +=) ) :
I know the original PR mentions : But apparently it's not only the empty square bracket syntax [] (= add a new item at the end) but any square bracket syntax [x] which looks not supported
How to reproduce
please check bug description section
Logs
No response
Environment
Installation
Fresh statamic/statamic site via CLI
Antlers Parser
None
Additional details
No response