CMS Development

Olon
Miembro

Accessing parameters in custom module

resolver

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 Me gusta
1 Soluciones aceptada
tjoyce
Solución
Experto reconocido | Partner nivel Elite
Experto reconocido | Partner nivel Elite

Accessing parameters in custom module

resolver

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

Ver la solución en mensaje original publicado

0 Me gusta
1 Respuesta 1
tjoyce
Solución
Experto reconocido | Partner nivel Elite
Experto reconocido | Partner nivel Elite

Accessing parameters in custom module

resolver

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 Me gusta