<?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-accordion2 <?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">
                <ul class="pxl-item--list pxl-list--content">
                    <?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' : '';
                            $index = '0'.(string)($key + 1);
                        ?>
                        <li class="pxl-item--single <?php echo esc_attr($active); ?>">
                            <span class="pxl-item--index">
                                <?php echo esc_attr($index); ?>
                            </span>
                            <<?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>
                        </li>
                    <?php endforeach; ?>
                </ul>
                <ul class="pxl-item--list pxl-list--features">
                    <div class="pxl-list--inner">
                        <?php foreach ($settings['items'] as $key => $item): ?>
                            <?php 
                                $featured = solarva_get_thumbnail($item['featured']['id'], 'full', true);
                                $active = ($key + 1) === $active_number ? 'active' : '';
                            ?>
                            <li class="pxl-item--featured <?php echo esc_attr($active); ?>" style="background-image: url('<?php echo esc_url($featured); ?>')">
                            </li>
                        <?php endforeach; ?>
                    </div>
                </ul>
            </div>
        </div>
    </div>
<?php endif; ?>

