CMS Development

SirHubalot
Member

Setting A Choice Property For A Module From Page Template

SOLVE

In a page template, I'm passing a value to my module to set the value of a choice property. Based on the documentation, I should be able to do this in the following manner:

 

{% module "related-posts" path='/path', label="Related Posts",
  language_select="option_1"
%}

 

This doesn't seem to work for me as the choice field when viewing the page template doesn't get set and displays the "option_1" value.

 

I've tried to pass the property value as the label as well, which doesn't work either.

 

Thanks for any help!

 

0 Upvotes
1 Accepted solution
piersg
Solution
Key Advisor

Setting A Choice Property For A Module From Page Template

SOLVE

It should work if you do this

{% module_block module "related-posts" wrapping_html='', per_widget_wrapper_html='', overrideable=True, widget_name='Related posts', module_id=1234, path='/path', language_select='option_1', label='Related posts' %}
{% end_module_block %}

View solution in original post

piersg
Solution
Key Advisor

Setting A Choice Property For A Module From Page Template

SOLVE

It should work if you do this

{% module_block module "related-posts" wrapping_html='', per_widget_wrapper_html='', overrideable=True, widget_name='Related posts', module_id=1234, path='/path', language_select='option_1', label='Related posts' %}
{% end_module_block %}
Teun
Key Advisor | Diamond Partner
Key Advisor | Diamond Partner

Setting A Choice Property For A Module From Page Template

SOLVE

Hi @SirHubalot ,

 

Are you using a dnd template?

If so, try this:

{% dnd_section %}
  {% dnd_module
    path = '<path-to-module>',
    width = 12,
    offset = 0,
    language_select = 'option_1'
  {% end_dnd_module %}
{% end_dnd_section %}


Did my answer solve your issue? Help the community by marking it as the solution.