<?php
    $html_id = pxl_get_element_id($settings);

    $template1 = (int)$widget->get_setting('popup_template','0');
    if($template1 > 0) {
        if(!has_action( 'pxl_anchor_target_page_popup_'.$template1)){
            add_action( 'pxl_anchor_target_page_popup_'.$template1, 'solarva_hook_anchor_page_popup' );
        }
    }

    $template2 = (int)$widget->get_setting('panel_template','0');
    if($template2 > 0 ){
        if ( !has_action( 'pxl_anchor_target_hidden_panel_'.$template2) ){
            add_action( 'pxl_anchor_target_hidden_panel_'.$template2, 'solarva_hook_anchor_hidden_panel' );
        } 
    }
    $btn_text = !empty($settings['btn_text']) ? $settings['btn_text'] : 'Learn More';
    $is_icon = !empty($settings['btn_icon']) || false;
    $btn_classes = $settings['btn_type'].' '.$settings['btn_basic_style'].' '.$settings['btn_icon_style'].' '.$settings['btn_play_style'].' '.$settings['btn_hover_style'].' '.$settings['btn_action'].' '.$settings['btn_popup_type'];

    $btn_types = ['pxl-btn-icon', 'pxl-btn-close'];
?>

<div id="pxl-<?php echo esc_attr($html_id) ?>" class="pxl-button <?php echo esc_attr($settings['pxl_animate']); ?>" data-wow-delay="<?php echo esc_attr($settings['pxl_animate_delay'].'ms'); ?>">
    <div class="pxl-item--container">
        <div class="pxl-item--inner">
            <a class="btn <?php echo esc_attr($btn_classes); ?>" <?php pxl_print_html(solarva_get_link($settings['btn_link'])); ?> data-text="<?php echo esc_attr($btn_text); ?>" 
            <?php if(!empty($settings['anchor_to_id'])): ?> data-anchor = "<?php echo esc_attr($settings['anchor_to_id'] ?? ''); ?>" data-offset="<?php echo esc_attr($settings['offset_top']); ?>" <?php endif; ?>>
                <span class="pxl-btn--icon">
                    <?php ($is_icon) ? \Elementor\Icons_Manager::render_icon( $settings['btn_icon'], [ 'aria-hidden' => 'true', 'class' => '' ], 'i' ) : ''; ?>
                </span>
                <?php if(!in_array($settings['btn_type'], $btn_types)) : ?>
                    <span class="pxl-btn--text"><?php echo esc_html($btn_text); ?></span>
                <?php endif; ?>
            </a>
        </div>
    </div>
</div>
