<?php
    $active_number = intval($settings['active']);
    $is_items = (isset($settings['items']) && !empty($settings['items']) && count($settings['items'])) || false;
    $title_tag = $settings['title_tag'];
?>
<?php if($is_items) : ?>
    <div class="pxl-accordion pxl-accordion1 <?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">
                <?php foreach ($settings['items'] as $key => $item): ?>
                    <?php 
                        $title = isset($item['title']) ? $item['title'] : 'Add title here.';
                        $content = isset($item['content']) ? $item['content'] : 'Add content here.'; 
                        $active = ($key + 1) === $active_number ? 'active' : '';
                    ?>
                    <div class="pxl-item--single <?php echo esc_attr($active); ?>">
                        <<?php echo esc_attr($title_tag); ?> class="pxl-item--title">
                            <span class="pxl-title--text"><?php echo wp_kses_post($title); ?></span>
                            <span class="pxl-icon--action"></i></span>
                        </<?php pxl_print_html($settings['title_tag']); ?>>
                        <div class="pxl-item--content">
                            <p><?php echo wp_kses_post(nl2br($content)); ?></p>
                        </div>
                    </div>
                <?php endforeach; ?>
            </div>
        </div>
    </div>
<?php endif; ?>

