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

Open in your IDE?
  1. {% sw_extends '@parent/storefront/utilities/icon.html.twig' %}
  2. {# ToDo: Implement fontAwesome #}
  3. {% block utilities_icon %}
  4.     {% set styles = [ size, color, rotation, flip, class ] %}
  5.    
  6.     {% if pack is not defined %}
  7.         {% if name starts with 'fa-' %}
  8.             {% set pack = 'fontawesome' %}
  9.         {% else %}
  10.             {% set pack = 'default' %}
  11.         {% endif %}
  12.     {% endif %}
  13.     {% if namespace is not defined %}
  14.         {% set namespace = 'Storefront' %}
  15.     {% endif %}
  16.     {% if themeIconConfig[pack] is defined %}
  17.         <span class="icon icon-{{ pack }} icon-{{ pack }}-{{ name }}{% for entry in styles %}{% if entry != "" %} icon-{{ entry }}{% endif %}{% endfor %}">
  18.             {{ source('@' ~ themeIconConfig[pack].namespace ~ '/../' ~ themeIconConfig[pack].path ~'/'~ name ~ '.svg', ignore_missing = true) }}
  19.         </span>
  20.     {% else %}
  21.         {% if pack == 'fontawesome' %}           
  22.             <span class="icon {% for entry in styles %}{% if entry != "" %} icon-{{ entry }}{% endif %}{% endfor %}" style=" {{ color ? 'color: ' ~ color ~ ';' : '' }}">
  23.                 <i class="{{ class ? class : 'fas'}} {{ name }} {{ size ? 'fa-' ~ size : '' }}" style="line-height: 1"></i>
  24.             </span>
  25.         {% else %}
  26.             <span class="icon icon-{{ name }}{% for entry in styles %}{% if entry != "" %} icon-{{ entry }}{% endif %}{% endfor %}">
  27.                 {# w/o cache #}
  28.                 {# {% set icon = source('@' ~ namespace ~ '/../app/storefront/dist/assets/icon/'~ pack ~'/'~ name ~'.svg', ignore_missing = true) %}
  29.                 {{ icon|raw }} #}
  30.                 {# w/ cache #}
  31.                 {% set icon = source('@' ~ namespace ~ '/assets/icon/'~ pack ~'/'~ name ~'.svg', ignore_missing = true) %}
  32.                 {{ icon|sw_icon_cache|raw }}
  33.             </span>
  34.         {% endif %}
  35.     {% endif %}
  36. {% endblock %}