<?php

use Tangibledesign\MyHome\Widgets\General\ButtonWidget;

/* @var ButtonWidget $mhCurrentWidget */
global $mhCurrentWidget;
?>
<div class="myhome-button-wrapper">
    <a
            class="myhome-button myhome-button--<?php echo esc_attr(str_replace('_', '-', $mhCurrentWidget->getButtonType())); ?>"
            href="<?php echo esc_url($mhCurrentWidget->getUrl()); ?>"
            title="<?php echo esc_attr($mhCurrentWidget->getText()); ?>"
    >
        <span>
            <?php echo esc_html($mhCurrentWidget->getText()); ?>

            <?php if (!empty($mhCurrentWidget->getIcon())) : ?>
                <?php if ($mhCurrentWidget->isSvgIcon()) : ?>
                    <?php tdf_load_icon($mhCurrentWidget->getIcon()); ?>
                <?php else : ?>
                    <i class="<?php echo esc_attr($mhCurrentWidget->getIcon()); ?>"></i>
                <?php endif; ?>
            <?php endif; ?>
        </span>
    </a>
</div>