<?php
/**
 * Partial template for displaying social media icons.
 *
 * Responsible for rendering the social media links within the theme.
 *
 * @package Yaatra
 */

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

$social_media_icons = yaatra_get_customizer_option_value( 'social_media_icons' );
$social_media_icons = json_decode( $social_media_icons );

if ( empty( $social_media_icons ) ) {
    return;
}
?>

<ul class="cv-social-icons-wrapper">
    <?php
        foreach ( $social_media_icons as $social_icon ) {
            // Skip if URL or icon is empty
            if ( empty( $social_icon->cv_url_field ) || empty( $social_icon->cv_icons_list ) ) {
                continue;
            }
    ?>
                <li class="social-icon social-link">
                    <a href="<?php echo esc_url( $social_icon->cv_url_field ); ?>" target="_blank">
                        <i class="<?php echo esc_attr( $social_icon->cv_icons_list ); ?>"></i>
                    </a>
                </li><!-- .social-icon -->
    <?php
        }
    ?>
</ul><!-- .cv-social-icons-wrapper -->