<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

/** @var Wishlist $block */

use Magento\Wishlist\Block\Catalog\Product\View\AddTo\Wishlist;

$theme_helper = $this->helper(Olegnax\Athlete2\Helper\Icons::class);
$wishlist_disabled = $theme_helper->getConfig('athlete2_settings/product/wishlist_disable');
if(!$wishlist_disabled):
$actions_position = $block->getData("actions_position") ?: $theme_helper->getConfig('athlete2_settings/product/actions_position');

$icon = '';
$iconfont = $theme_helper->getConfig('athlete2_design/appearance_icons_product/product_icon_wishlist_fallback') ? 'athlete2-icon-heart' : '';
if(!$iconfont){
    $icon_option   = 'athlete2_design/appearance_icons_product/product_icon_';
    $icon = $theme_helper->getIconHTML('wishlist', $icon_option); // $name, $icon_option = '', $classes = ''
}
?>
<?php if ($block->isWishListAllowed()) : ?>
	<?php if ('2' == $actions_position) { ?>
    <a href="#"
       class="action towishlist <?php echo $iconfont ?> a2-tooltip-btn"
       data-post='<?= /* @noEscape */ $block->getWishlistParams() ?>'
       data-action="add-to-wishlist">
       <?php echo $icon ?>
       <span class="a2-tooltip"><?= $block->escapeHtml(__('Add to Wish List')) ?></span>
    </a>
	<?php } else { ?>
    <a href="#"
       class="action towishlist <?php echo $iconfont ?>"
       data-post='<?= /* @noEscape */ $block->getWishlistParams() ?>'
       data-action="add-to-wishlist">
       <?php echo $icon ?>
       <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span>
    </a>
	<?php } ?>
<?php endif; ?>
<script type="text/x-magento-init">
    {
        "body": {
            "addToWishlist": <?= /* @noEscape */ $block->getWishlistOptionsJson() ?>
        }
    }
</script>
<?php endif; ?>
