<?php
    $widget->add_render_attribute( 'counter', [
        'class' => 'pxl-number--value '.$settings['effect'],
        'data-duration' => $settings['duration'],
        'data-startnumber' => $settings['starting_number'],
        'data-endnumber' => $settings['ending_number'],
        'data-to-value' => $settings['ending_number'],
        'data-delimiter' => $settings['thousand_separator_char'],
    ]); 
    $is_users = (isset($settings['users']) && !empty($settings['users']) && count($settings['users'])) || false;
    $title = $widget->parse_text_editor( $settings['title'] ); 
?>

<div class="pxl-counter pxl-counter4">
    <div class="pxl-item--container">
        <div class="pxl-item--inner">
            <div class="pxl-item--holder">
                <?php if(!empty($settings['title'])) : ?>
                    <div class="pxl-item--title"><?php pxl_print_html($title); ?></div>
                <?php endif; ?>
                <span class="pxl-item--divider"></span>
                <ul class="pxl-item--list">
                    <?php if($is_users): ?>
                        <?php foreach($settings['users'] as $user) : ?>
                            <?php 
                                $avatar = solarva_get_thumbnail($user['avatar']['id']);    
                            ?>
                            <li class="pxl-item--single">
                                <?php pxl_print_html($avatar); ?>
                            </li>
                        <?php endforeach ?>
                    <?php endif; ?>
                    <li class="pxl-item--single">
                        <div class="pxl-item--number">
                            <?php if(!empty($settings['prefix'])) : ?>
                                <span class="pxl-item--prefix"><?php pxl_print_html($settings['prefix']); ?></span>
                            <?php endif; ?>
                            <span 
                                <?php pxl_print_html($widget->get_render_attribute_string( 'counter' )); ?>>
                                <?php echo esc_html($settings['starting_number']); ?>
                            </span>
                            <?php if(!empty($settings['suffix'])) : ?>
                                <span class="pxl-item--suffix"><?php pxl_print_html($settings['suffix']); ?></span>
                            <?php endif; ?>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>