根据 Shopify 主题教程https://help.shopify.com/themes/development/theme-editor/settings-schema
文件,我们可以通过 set {% schema %} 部分定义主题设置,如下例所示:
{% schema %}
{
"name": "Line",
"class": "index-section",
"settings": [
{
"type": "radio",
"id": "small_line",
"label": "Correct Gap",
"options": [
{
"value": "none",
"label": "None"
},
{
"value": "gap1",
"label": "Different Gap"
}
],
"default": "none"
}
],
"presets": [
{
"name": "Line",
"category": "Design",
"settings": {
}
}
]
}
{% endschema %}
我的问题是否有一种方法可以在架构部分中将此设置设置为动态的,例如在上面的示例中将“small_line”选项定义为变量,类似于以下内容
{% schema %}
{
"name": "Line",
"class": "index-section",
"settings": [
{
"type": "radio",
"id": "small_line",
"label": "Correct Gap",
"options": MY_OPTIONS_VAR,
"default": "none"
}
],
"presets": [
{
"name": "Line",
"category": "Design",
"settings": {
}
}
]
}
{% endschema %}