custom/plugins/WynTheme/src/Resources/views/storefront/utilities/icon.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/utilities/icon.html.twig' %}
  2. {% block utilities_icon %}
  3.   {% set styles = [ size, color, rotation, flip, class ] %}
  4.   {% if pack is not defined %}
  5.     {% set pack = 'default' %}
  6.   {% endif %}
  7.   {% if namespace is not defined %}
  8.     {% set namespace = 'Storefront' %}
  9.   {% endif %}
  10.   {% if theme_config('wyn-iconset') %}
  11.     {% set iconPath = theme_config('wyn-iconset') %}
  12.   {% else %}
  13.     {% set iconPath = 'default' %}
  14.   {% endif %}
  15.   {% set wynNamespace = 'WynTheme' %}
  16.   {% set wynNamespaceExtension = 'WynCustomerTheme' %}
  17.   {# First try to find the icon in @WynCustomerTheme/app/storefront/dist/assets/icon/[icon-set]/[name].svg #}
  18.   {% if source('@' ~ wynNamespaceExtension ~ '/app/storefront/dist/assets/icon/' ~ iconPath ~'/'~ name ~'.svg', ignore_missing = true) %}
  19.     {% set pack = iconPath %}
  20.     {% set namespace = wynNamespaceExtension %}
  21.   {# No matching icon found in WynCustomerTheme, try WynTheme, otherwise try default Shopware icons #}
  22.   {% elseif source('@' ~ wynNamespace ~ '/app/storefront/dist/assets/icon/' ~ iconPath ~'/'~ name ~'.svg', ignore_missing = true) %}
  23.     {% set pack = iconPath %}
  24.     {% set namespace = wynNamespace %}
  25.   {% endif %}
  26.   <span
  27.     class="icon icon-{{ name }}{% for entry in styles %}{% if entry != "" %} icon-{{ entry }}{% endif %}{% endfor %}"
  28.     {% if slotAttr %}slot="{{ slotAttr }}"{% endif %}
  29.   >
  30.     {# source() inserts the file contents, i.e. the SVG code of the icon #}
  31.     {{ source('@' ~ namespace ~ '/app/storefront/dist/assets/icon/' ~ pack ~'/'~ name ~'.svg', ignore_missing = true) }}
  32.   </span>
  33. {% endblock %}