{% sw_extends '@Storefront/storefront/component/product/card/wishlist.html.twig' %}
{% block component_product_wishlist %}
{% set addToWishlistOptions = {
productId: productId,
router: {
add: {
afterLoginPath: path('frontend.wishlist.add.after.login', { productId: productId }),
path: path('frontend.wishlist.product.add', { productId: productId }),
token: sw_csrf('frontend.wishlist.product.add', {"mode": "token"})
},
remove: {
path: path('frontend.wishlist.product.remove', { productId: productId }),
token: sw_csrf('frontend.wishlist.product.remove', {"mode": "token"}),
}
}
} %}
{% set size = size ?? 'md' %}
<div class="product-wishlist">
{% block component_product_wishlist_button %}
{# TODO class="product-wishlist-{{ productId }} btn btn-icon btn-icon--light btn-icon--rounded btn-icon--with-shadow {% if size == 'md' %}btn-icon--small{% endif %} wishlist-button product-wishlist-not-added product-wishlist-loading js-tooltip"#}
<wyn-button
variant="secondary"
icon-button
{% if size == 'md' %}size="small"{% endif %}
class="product-wishlist-{{ productId }} wishlist-button product-wishlist-not-added product-wishlist-loading js-tooltip"
title="{{ "listing.toggleWishlist"|trans|sw_sanitize }}"
data-add-to-wishlist="true"
data-add-to-wishlist-options="{{ addToWishlistOptions|json_encode }}"
>
{% block component_product_wishlist_icon %}
{% sw_icon 'heart-fill' style { 'class': 'wishlist icon-wishlist-added', 'size': size, 'slotAttr': 'icon' } %}
{% sw_icon 'heart' style {'class': 'wishlist icon-wishlist-not-added', 'size': size, 'slotAttr': 'icon' } %}
{% if showText %}
<span class="product-wishlist-btn-content text-wishlist-not-added product-wishlist-btn-content-{{ size }}">
{{ "listing.addToWishlist"|trans|sw_sanitize }}
</span>
<span class="product-wishlist-btn-content text-wishlist-remove product-wishlist-btn-content-{{ size }}">
{{ "listing.removeFromWishlist"|trans|sw_sanitize }}
</span>
{% endif %}
{% endblock %}
</wyn-button>
{% endblock %}
</div>
{% endblock %}