CMS Development

Olon
Membro

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 Avaliação positiva
1 Solução aceita
tjoyce
Solução
Especialista reconhecido(a) | Parceiro Elite
Especialista reconhecido(a) | Parceiro 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

Exibir solução no post original

0 Avaliação positiva
1 Resposta 1
tjoyce
Solução
Especialista reconhecido(a) | Parceiro Elite
Especialista reconhecido(a) | Parceiro 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 Avaliação positiva