Hi,
I’m having an issue where I’m trying to add a
Caller()
to my macro to be able to pass additional props when using {& call rich_text %} macro but for some reason when I tried adding in caller() and uploading it to hs via the CLI it kept on giving me errors and wouldn’t let me. I tried writing the code directly in the design manager and it seems to give me no issues there so is there anything I’m missing or is this a CLI bug.
This is the full macro code
{% macro rich_text(module) -%}
{% set class = '' %}
{% if module.alignment == 'center' %}
{% set class = class ~ ' mx-auto my-0 text-center' %}
{% elif module.alignment == 'right' %}
{% set class = class ~ 'mr-0 my-0 ml-auto text-right' %}
{% endif %}
{% set max_width = 'max-width: ' ~ module.max_width.value ~ 'px;' %}
<div class="{{ class }}"
{% if module.max_width and module.max_width.enabled %} style="{{ max_width }}" {% endif %}>
{% if module.preheader %}
<span class="el-preheader"
{% if module.preheader_color.overwrite %}style="color: {{ render_color(module.preheader_color.color) }}"{% endif %}>
{{ module.preheader }}
</span>
{% endif %}
<div>{{ module.content }}</div>
{{ caller() }}
{% if module.buttons|length > 0 %}
<div class="flex gap-4 mt-6">
{% for button in module.buttons %}
{{ render_button(button) }}
{% endfor %}
</div>
{% endif %}
</div>
{%- endmacro %}
and this is how I’m calling it
<div class="">
{% call rich_text(module) %}
<div
class="flex gap-4 sm:gap-8 w-full items-center justify-between my-10 md:my-16"
>
{% for company in module.companies %}
<div class="">
<img
src="{{ company.src }}"
alt="{{ company.alt }}"
class="object-contain"
/>
</div>
{% endfor %}
</div>
{% endcall %}
</div>
Potential issue could be that my {{ render_button }} macro is also invoiking a call for another macro so theres a lot of nesting happening.
Thanks for the help