{%- if context %} {% set badge_href = context.badge_href %} {% set theme = context.theme %} {% set text = context.text %} {% set style = context.style %} {% set html = context.html %} {% endif -%} {# Determine type of element to use, if not explicitly set -#} {% spaceless %} {% if badge_href %} {% set tags = 'a' %} {% else %} {% set tags = 'span' %} {% endif %} {# Work out what colour theme is needed for the styling #} {% if theme %} {% set theme_class = theme %} {% endif %} {# Decide upon which 'style' the badge has #} <{{tags}} {# If there's an href put it here #} {%- if tags == 'a' %} href="{{ badge_href if badge_href else '#' }}" {%- endif %} {# You're using an ID? Really?? That'll go here #} {% if id %} id="{{-id-}}"{% endif %} class="vf-badge {#- This will list the them classname #} {%- if theme_class %} vf-badge--{{theme_class}}{% endif %} {# If you're styling the shape of the item, the classnames will render in this for loop #} {%- if style %} {% for styles in style %} vf-badge--{{styles}}{% endfor -%} {% endif -%} {# You want a snowflake of a classname for something, here you go #} {%- if override_class %} | {{override_class}}{% endif -%} "> {{- html | safe if html else text -}} {% endspaceless %}