Hello. I am building a theme block via an app that requires a user to upload either an image, video, or text. They can do this up to 6 times so in all 18 fields. Is there a way to be able to include a dynamic loop in my scheme settings so I do not have to hardcode 18 fields?
My code:
{% schema %}
{
"name": "Test Block",
"target": "section",
"settings": [
{
"type": "header",
"content": "Test Block",
"info": "Use the fields below to add text or a video"
},
{
"type": "text",
"id": "title",
"label": "Block Title",
"default": "Heading"
},
{
"type": "textarea",
"id": "description",
"label": "Description",
"default": "Description"
},
{
"type": "header",
"content": "Block 1",
},
---- Section I would like to loop ---
{
"type": "image_picker",
"id": "Test_image",
"label": "Image"
},
{
"type": "video",
"id": "Test_video",
"label": "Video"
},
{
"type": "text",
"id": "Test_quote",
"label": "Quote"
}
-----------
],
}
{% endschema %}
So something like this?
{% for i in (1..5) %}
{% if i == 4 %}
{% break %}
{% else %}
{
"type": "image_picker",
"id": "Test_image",
"label": "Image"
},
{
"type": "video",
"id": "Test_video",
"label": "Video"
},
{
"type": "text",
"id": "Test_quote",
"label": "Quote"
}
{% endif %}
{% endfor %}