CMS Development

Olon
Mitglied

Accessing parameters in custom module

lösung

Hello,

in the docs, it says we can add custom parameters to modules. However the way to access them from inside the module is not specified. Heres my code:

 

{% module "module_152889614697214" module_id="3085289" label='Test', myParam='hello' %}

I've tried module.myParam with no luck.

 

Thanks

0 Upvotes
1 Akzeptierte Lösung
tjoyce
Lösung
Trendsetter/-in | Elite Partner
Trendsetter/-in | Elite Partner

Accessing parameters in custom module

lösung

The parameter cannot be arbitrary. You need to create the field in the custom module builder and then when you call it with the HUBL code in your template, that parameter name needs to match the parameter name inside the module.

 

Example:

In the dropdown in the custom module builder, you would choose text_field with a name of my_text_fied, now, you can pass a parameter that matches that name

{% module "module_152889614697214" module_id="3085289" label='Test', my_text_field='hello' %}

Then, inside of your module, all you have to do is 

{{module.my_text_field}}

tim@belch.io

Lösung in ursprünglichem Beitrag anzeigen

0 Upvotes
1 Antwort
tjoyce
Lösung
Trendsetter/-in | Elite Partner
Trendsetter/-in | Elite Partner

Accessing parameters in custom module

lösung

The parameter cannot be arbitrary. You need to create the field in the custom module builder and then when you call it with the HUBL code in your template, that parameter name needs to match the parameter name inside the module.

 

Example:

In the dropdown in the custom module builder, you would choose text_field with a name of my_text_fied, now, you can pass a parameter that matches that name

{% module "module_152889614697214" module_id="3085289" label='Test', my_text_field='hello' %}

Then, inside of your module, all you have to do is 

{{module.my_text_field}}

tim@belch.io

0 Upvotes