<?php
use Elementor\Plugin;

    /**
     * value of the config
     */
    $smart_toggle_primary_title = widgetkit_pro_array_get($settings, 'smart_toggle_primary_title');
    $primary_content_type = widgetkit_pro_array_get($settings, 'primary_content_type');
    $primary_content = ("content"==$primary_content_type) ?  widgetkit_pro_array_get($settings, 'primary_content') : null;
    $primary_saved_template = ("saved_template"==$primary_content_type) ? widgetkit_pro_array_get($settings, 'primary_saved_template') : null;
    
    $smart_toggle_secondary_title = widgetkit_pro_array_get($settings, 'smart_toggle_secondary_title');
    $secondary_content_type = widgetkit_pro_array_get($settings, 'secondary_content_type');
    $secondary_content = ("content"==$secondary_content_type) ? widgetkit_pro_array_get($settings, 'secondary_content') : null;
    $secondary_saved_template = ("saved_template"==$secondary_content_type) ? widgetkit_pro_array_get($settings, 'secondary_saved_template') : null;


?>
<div id="<?php echo $this->get_id(); ?>" class="smart-toggle-content">
    <div class="toggle-wrapper" style="display:flex;">
        <span class="primary-title">
            <?php echo $smart_toggle_primary_title;?>
        </span>
        <div class="toggle">
            <input type="checkbox" class="check">
            <b class="b switch"></b>
            <b class="b track"></b>
        </div>
        <span class="secondary-title">
            <?php echo $smart_toggle_secondary_title;?>
        </span>
    </div>
    <div class="smart-toggle-content-wrapper active-primary">
        <div class="primary-content">
            <?php 
                if (  $primary_content  ) {
                    echo $primary_content;
                }
                if($primary_saved_template){
                    echo Plugin::$instance->frontend->get_builder_content($primary_saved_template, true);
                }
            ?>
        </div>
        <div class="secondary-content">
            <?php 
                if (  $secondary_content  ) {
                    echo $secondary_content;
                }
                if($secondary_saved_template){
                    echo Plugin::$instance->frontend->get_builder_content($secondary_saved_template, true);
                }
            ?>
        </div>
    </div>
    
</div>