CMS Development

vin-aws
Contributor

How to access variable inside {{ }}

SOLVE

I want to access a widget by doing {{ content.widgets.{{parent_custom_widget_name}}_my_name }} but am not finding it possible to concatenate the {{ parent_custom_widget_name }} inside the {{ content.widgets.... }} block. Is this possible?

1 Accepted solution
tjoyce
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

How to access variable inside {{ }}

SOLVE

Assuming parent_custom_widget_name is a HUBL variable, the following code should work:

 

{% set parent_custom_widget_name = "somModuleID_68439" %}
{{content.widgets[parent_custom_widget_name+'_my_name']}}

tim@belch.io

View solution in original post

1 Reply 1
tjoyce
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

How to access variable inside {{ }}

SOLVE

Assuming parent_custom_widget_name is a HUBL variable, the following code should work:

 

{% set parent_custom_widget_name = "somModuleID_68439" %}
{{content.widgets[parent_custom_widget_name+'_my_name']}}

tim@belch.io