{% import "./link.html" %} {% import "../helpers/general.html" %} {% macro button(data = {}) -%} {% set args = { "visible" : true, "button_type" : "standard", "cta" : null, "button_label" : "Button Text", "button_style" : "primary", "button_link" : { "url" : { "content_id" : null, "type" : "EXTERNAL", "href" : "#" }, "open_in_new_tab" : false, "no_follow" : false }, "styles" : {}, "class" : "" } %} {% do args.update(data) %} {% set enable = (args.visible is defined && args.visible) || args.visible is not defined %} {% if enable %} {% if args.button_type == 'cta' %} {% cta "button_cta" guid={{ args.cta }} %} {% else %} {% set style = ((args.button_type == 'outline') ? 'outline-' : '')+args.button_style %} {# Set Classes #} {% set class = args.class|split(' ') %} {% if args.button_type == 'simple' %} {% do class.append('btn-link link-'+style) %} {% else %} {% do class.append('btn btn-'+style+' btn-'+args.button_type) %} {% endif %} {# Get Link #} {% set linkData = { "link" : args.button_link, "styles" : args.styles, "class" : class|join(' '), "noLinkTag" : "button" } %} {% set linkData = maybeLinkData(linkData)|fromjson %} <{{ linkData.tag }} {{ linkData.attr|xmlattr }}>{{ args.button_label }} {% endif %} {% endif %} {%- endmacro %} {%- macro buttonSet(data = {}) -%} {% set args = { "show" : true, "buttons" : [], "class" : "mt-2" } %} {% do args.update(data) %} {% set ctas = [] %} {% for btn in args.buttons %} {% if (btn.visible is defined && btn.visible) || btn.visible is not defined %} {% do ctas.append(btn) %} {% endif %} {% endfor %} {% if ctas|length && args.show %}
{% for button in ctas %} {% set extraClass = ['mb-1','mb-md-0'] %} {% do !loop.last ? extraClass.append('me-1') : '' %} {% do button.update({ "class" : extraClass|join(' ') }) %} {{ button(button) }} {% endfor %}
{% endif %} {%- endmacro %}