OpenContent
OpenContent copied to clipboard
Referencing parent values inside an {{#equal}} needs an extra ../
Trying to create a fallback color I use this schema:
"LinkDefaults": {
"type": "object",
"title": "Link Layout",
"properties": {
"Color": {
"title": "Default Colour",
"type": "string",
"enum": [
"",
"Col1ExtraLight",
"Col1Light",
"Col1Medium",
],
"default": "Col1Medium"
}
}
},
"Links": {
"type": "array",
"title": "Links",
"items": {
"type": "object",
"title": "Link",
"properties": {
"Text": {
"type": "string",
"title": "Text"
},
"Color": {
"title": "Colour",
"type": "string",
"enum": [
"inherit",
"Col1ExtraLight",
"Col1Light",
"Col1Medium",
],
"default": "inherit"
}
}
}
},
Now if I try to reference the fallback color I can use:
{{../LinkDefaults.Color}}
But when I try this inside an {{#equal}}
I have to use {{../../LinkDefaults.Color}} <a class=" {{#equal Color "inherit"}} {{../../LinkDefaults.Color}}Bg {{else}} {{Color}}Bg {{/equal}}"> {{Text}}
That seems a bit counter intuitive :-)
I had nested #equals and had to use ../../../LinkDefaults.Color to get this to work