<?php

use iwbvel\classes\helpers\Sanitizer;

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

$iwbvel_tab_title = (!empty($tab['title'])) ? $tab['title'] : esc_html__('Tab title', 'ithemeland-bulk-variation-editing-for-woocommerce');
$iwbvel_tab_content = (!empty($tab['content'])) ? wp_kses($tab['content'], Sanitizer::allowed_html()) : '';
$iwbvel_unique_id = (!empty($tab_unique_id)) ? $tab_unique_id : 'editor-' . wp_rand(100, 999);
?>

<div class="iwbvel-yikes-tab-item" <?php echo (!empty($iwbvel_duplicate_item)) ? 'id="duplicate-item"' : ''; ?>>
    <div class="iwbvel-yikes-tab-item-header">
        <strong class="iwbvel-yikes-tab-item-header-title"><?php echo esc_html($iwbvel_tab_title); ?></strong>
        <button type="button" class="iwbvel-yikes-tab-item-sort"><i class=" iwbvel-icon-menu1"></i></button>
        <button type="button" class="iwbvel-yikes-tab-item-remove"><i class="iwbvel-icon-x"></i></button>
        <?php if (!empty($tab['global'])) : ?>
            <label class="iwbvel-yikes-tab-override"><input type="checkbox" class=iwbvel-yikes-override-tab" name="override_tab" value="1"> <?php esc_html_e('Override Saved Tab', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
        <?php endif; ?>
    </div>
    <div class="iwbvel-yikes-tab-item-body">
        <input type="hidden" name="global_tab" value="<?php echo (!empty($tab['global'])) ? esc_attr($tab['global']) : '' ?>" data-global-id="<?php echo (!empty($tab['global'])) ? esc_attr($tab['global']) : '' ?>">
        <div class="iwbvel-yikes-tab-title">
            <label><?php esc_html_e('Tab title', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
            <input type="text" placeholder="<?php esc_html_e('Tab title ...', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>" value="<?php echo esc_attr($iwbvel_tab_title); ?>">
        </div>
        <div class="iwbvel-yikes-tab-content" data-id="<?php echo esc_attr($iwbvel_unique_id); ?>">
            <label><?php esc_html_e('Tab content', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
            <?php if (!empty($iwbvel_duplicate_item)) : ?>
                <textarea placeholder="<?php esc_html_e('Content ...', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>"></textarea>
            <?php
            else :
                wp_editor($iwbvel_tab_content, $iwbvel_unique_id);
            endif;
            ?>
        </div>
    </div>
</div>