Hi all,
I’m trying to create a custom module which enables me to use an editable text field to modify a variable to use in an options variable in order to make repeatable blocks.
I have a text field named widget.repeats which has a default value of 5, but could be anything. I’m storing this by using this variable:
{% set repeats = widget.repeats %}
Next I have another variable which I’m going to use to loop through:
{% set my_options = range(1, repeats) %} // Not working, should output range(1, 5){% set my_options = range(1, {{repeats}}) %} // Not working, should output range(1, 5)
However these variables throw an error. How am I supposed to make this work? When I get this to work I could do something like:
{% for options in my_options %} {% if loop.index <= widget.repeats %} // Repeat this
{% endif %}
{% endfor %}
Thanks in advance!