I have 3 sets of globals, which use the same fields handles.

{{ firstGlobalHandle.aFieldHandle }}
{{ secondGlobalHandle.aFieldHandle }}
{{ thirdGlobalHandle.aFieldHandle }}

In a child template, I set a variable corresponding to the handle of the global group which I need to call

{% set globalHandle = "secondGlobalHandle" %}

Now in the In the parent template, I would like to do the following :

{{ '{{ globalHandle }}'.aFieldHandle }}

Is there any way to do so ?


OK, my bad, this was answered here

Here is the solution :

{{ _context[ globalHandle ].aFieldHandle }}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.