{% sw_extends '@Storefront/storefront/utilities/icon.html.twig' %}
{% block utilities_icon %}
{% set styles = [ size, color, rotation, flip, class ] %}
{% if pack is not defined %}
{% set pack = 'default' %}
{% endif %}
{%- if namespace is not defined -%}
{% set namespace = 'Storefront' %}
{%- endif -%}
{%- if themeIconConfig[pack] is defined -%}
<span class="icon icon-{{ pack }} icon-{{ pack }}-{{ name }}{% for entry in styles %}{% if entry != "" %} icon-{{ entry }}{% endif %}{% endfor %}">
{% set icon = source('@' ~ themeIconConfig[pack].namespace ~ '/' ~ themeIconConfig[pack].path ~'/'~ name ~ '.svg', ignore_missing = true) %}
{{ icon|sw_icon_cache|raw }}
</span>
{%- else -%}
<span class="icon icon-{{ name }}{% for entry in styles %}{% if entry != "" %} icon-{{ entry }}{% endif %}{% endfor %}">
{% if pack == 'bodymed' %}
{% set namespace = 'MadBodymedTheme' %}
{# % set icon = source('@MadBodymedTheme/assets/icon/'~ pack ~'/'~ name ~'.svg', ignore_missing = true) %#}
{% endif %}
{% set icon = source('@' ~ namespace ~ '/assets/icon/'~ pack ~'/'~ name ~'.svg', ignore_missing = true) %}
{{ icon|sw_icon_cache|raw }}
</span>
{%- endif -%}
{% endblock %}