How to pass images into custom modules called via HubL?
SOLVE
If I understand you correctly then I am not sure you need to do what you are trying to do.
If you create a custom module, or use any module for that matter, and place it in a template, the contents of that module are editable per page. 1 template can create 100+ pages, all with different content. There is no need for trickery as this is the primary function of a template in any cms.
Is this what you are going for?
Edit: I just saw your edit. You can't use HubL in rich text editors save for the contact tokens for some reason. that is why the markup is displaying as markup.
It might help if you shared what exactly you were wanting to accomplish. You can't overwrite the content of a custom module in your code, well you could but you would need to export it to the template and then you would have to basically build it back out in your code using the data from the module because it will no longer output it's default to the template. It would be messy. Maybe there is a better way to do what you are wanting.
How to pass images into custom modules called via HubL?
SOLVE
Thank you for replying :-).
I am basically trying to make a collection of templated modules that can be mixed and matched between different HTML templates. The templated modules will have Lorem Ipsum in them, but the HTML templates will pass the unique filler text to those modules. So all the emails share the same modules, just different text. The obvious answer is to make unique modules for everything, but then we are talking about replicating code a couple hundred times.
I am able to make a sort of solution by doing this in the HTML email file:
{% set var_one = "Join us at your <span style=\"color:#ff6305; font-weight:bold;\"> next local user group!</span>" %} {% custom_widget "orange_juice_basic_headline" widget_name="orange_juice_basic_headline" %}
and then adding this line to the module:
{% rich_text "Headline" label="Headline" html="{% if var_one %}{{ var_one }}{% else %}Lorem ipsum dolor sit amet, <span style=\"color:#ff6305; font-weight:bold;\"> consectetur adipiscing elit!</span>{% endif %}" %}
But when you go to edit this as an actual email, you see this:
Rather than the text I've populated var_one with. Any ideas?
How to pass images into custom modules called via HubL?
SOLVE
If I understand you correctly then I am not sure you need to do what you are trying to do.
If you create a custom module, or use any module for that matter, and place it in a template, the contents of that module are editable per page. 1 template can create 100+ pages, all with different content. There is no need for trickery as this is the primary function of a template in any cms.
Is this what you are going for?
Edit: I just saw your edit. You can't use HubL in rich text editors save for the contact tokens for some reason. that is why the markup is displaying as markup.
How to pass images into custom modules called via HubL?
SOLVE
No Problem at all.
Also, I tested the code you shared. The markup showed in the rich text editor in the page editor, but the actual page showed the value of the variable. I guess the rich text editor doesn't process the Hubl for view in the editor but does still process it to the page.