If the page creator toggles the enable switch, then the value is now updated correctly and the correct boolean is printed. Otherwise, null is received.
That's said, I've understood that my template can override the default values set by the custom module, like below:
When doing that, the default value is correctly gotten. Well, almost...
When creating a new page from the template, it seems that it works randomly. Sometimes it does and everything is OK, and sometimes it does not, and the creator has to reload the page to make it work. What do I do wrong?
Anyway, even when it works, it's required to define this default value on the custom module and when calling it on the Hubl template, which is not so convenient...
So, this is the context, now my questions:
Can you confirm that the correct way for a template to get actual module values is to set the default ones when calling it?
If so, why does it work only sometimes?
And what's the point of defining default values directly on module fields (like my first screenshot) if we have to redefine them in the templates? It's very confusing to not get them from the template.
Hi Adrien, You're writing with Boolean "widgets". The don't have a specific value. Only "true" or "false". Therefore you have to write
{% if.module.widget_name %} some content that should be visible if the checkbox is checked(true state)
{% endif %}
To make your life easier copy the snippet of the widget and paste your content between the if statement.
For your questions:
1. It's not nessesary too define default values in modules. But it can be a Time saver.
2. If you're calling/using the same module more than once in a template you have to give each an individual name and label. Otherwise they will override each other.
3. Imo default values in modules make sense of you're using the same module multiple times with the same content or want to show the content editor "what is where". On normal occasion you define the content of the module in the "page building mode"
Hi Adrien, You're writing with Boolean "widgets". The don't have a specific value. Only "true" or "false". Therefore you have to write
{% if.module.widget_name %} some content that should be visible if the checkbox is checked(true state)
{% endif %}
To make your life easier copy the snippet of the widget and paste your content between the if statement.
For your questions:
1. It's not nessesary too define default values in modules. But it can be a Time saver.
2. If you're calling/using the same module more than once in a template you have to give each an individual name and label. Otherwise they will override each other.
3. Imo default values in modules make sense of you're using the same module multiple times with the same content or want to show the content editor "what is where". On normal occasion you define the content of the module in the "page building mode"