I’m developing a sub-theme with an address state/province selector in the config.json:
{
"name": "state",
"label": "State",
"group": "Contact",
"type": "select",
"options": [
{
"label": "Alabama",
"value": "AL"
},
{
"label": "Alaska",
"value": "AK"
}
]
}
In my template, the state is in an `` element:
<abbr>{{@config.custom.state.stateName}}</abbr>
Is there a way to access the `label` from the json file? If so I could do something like this:
<abbr title="{{@config.custom.state.stateNameLabel}}">{{@config.custom.state.stateName}}</abbr>
with the result:
<abbr title="Alabama">AL</abbr>
Or, is there another way to send both an abbreviation and full name to the template? I was thinking something like:
{
"name": "state",
"label": "State/territory",
"group": "Contact info",
"type": "select",
"options": [
{
"label": "Alabama",
"value": [
"AL",
"Alabama"
]
},
{
"label": "Alaska",
"value": [
"AK",
"Alaska"
]
}
]
}
But there’s no way to access the value. Using <code class=”EnlighterJSRAW” data-enlighter-language=”generic”>@config.custom.state.stateName produces no output, while <code class=”EnlighterJSRAW” data-enlighter-language=”generic”>@config.custom.state.stateName.value[0] produces an error.
Meta: I’m putting this in General Inquiry, maybe it belongs in Feature Suggestions? (Or maybe in the bit bucket!)