<?php 
    $is_languages = (isset($settings['languages']) && !empty($settings['languages']) && count($settings['languages'])) || false;
?>
<div class="pxl-switch-language">
    <div class="pxl-item--container">
        <div class="pxl-item--inner">
            <form action="#" class="pxl-form-select pxl-form-switch-language">
                <button type="button" class="btn pxl-btn-switch pxl-btn">
                    <span class="pxl-btn--text"><?php echo esc_html('Eng', 'solarva'); ?></span>
                    <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
                        <path d="M14.25 6.75L9 12L3.75 6.75" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                    </svg>
                </button>
                <?php if($is_languages) : ?>
                    <ul class="pxl-list--languages">
                        <?php foreach($settings['languages'] as $key => $language) : ?>
                            <?php 
                                $split_text = substr($language['language'], 0, 3)  
                            ?>
                            <li class="pxl-item--language <?php if($settings['active'] == $key) echo esc_attr('current-language'); ?>" data-language = "<?php echo esc_attr($split_text); ?>">
                                <?php echo esc_html($language['language']); ?>
                            </li>
                        <?php endforeach; ?>
                    </ul>
                <?php endif; ?>
            </form>
        </div>
    </div>
</div>