<?php

use Elementor\Utils;
use Elementor\Icons_Manager;

if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly
}

list($animate_class, $animation_attr) = tfl_get_animation_atts($settings['widget_animation']);
$icon = $settings['icon'];

?>


<div class="tfl-iconbox-v2 tfl-style2  <?php if(!empty($icon)) echo 'has-icon'; ?> dark-mode-<?php echo $settings['dark_mode']; ?> tfl-align-<?php echo $settings['align']; ?> <?php echo $animate_class; ?>" <?php echo $animation_attr; ?>>


        <?php 
        $icon = $settings['icon']; 
        $icon_output = "";
            if ( !empty( $settings['icon']['value']['url'] ) ) {
                $icon_output .= sprintf(
                   '<img class="logo_svg" src="%1$s" alt="%2$s"/>',
                     $icon['value']['url'],
                     $icon['value']['id']
                    
                 ); 
            } else {
                $icon_output .= sprintf(
                     '<i class="%1$s"></i>',
                    $icon['value']
                );  
            }
        ?>
        <?php if (!empty($icon['value'])): ?>
            <div class="tfl-image-wrapper">
                <?php echo $icon_output; ?>
            </div>
        <?php endif; ?>

        <div class="tfl-content-wrapper">

            <?php if (!empty($settings['iconbox'])): ?>
            <<?php echo Utils::validate_html_tag($settings['title_tag']); ?> class="tfl-title">

            <?php if(isset($settings['link']['url']) && !empty($settings['link']['url'])): ?>
                <a href="<?php echo $settings['link']['url']; ?>">
            <?php endif; ?>

            <?php

            echo wp_kses_post($settings['iconbox']); ?>

            <?php if(isset($settings['link']['url']) && !empty($settings['link']['url'])): ?>
                </a>
            <?php endif; ?>

        </<?php echo Utils::validate_html_tag($settings['title_tag']); ?>>

    <?php endif; ?>

        <?php if (!empty($settings['short_text'])): ?>

            <p class="tfl-text"><?php echo wp_kses_post($settings['short_text']); ?></p>

        <?php endif; ?>
    </div>

</div><!-- .tfl-iconbox -->