I am trying to set a data- attribute for a save button, but it doesn't like the nested braces. I'm getting an error on the "###THIS LINE" line.
{% for file in payment.files %}
<br>
<li>
...
... etc...
...
{{ form_widget(file.save, {'attr':{'data-file-id': {{ file.id}} } }) }} ###THIS LINE
</li>
{% endfor %}
The error I am getting is: A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "punctuation" of value "{".
I guess it doesn't like the nested braces.
Any help is greatly appreciated.
{{ form_widget(file.save, {'attr':{'data-file-id': file.id } }) }}(you are already in a twig statement when you addfile.idas parameter)