<?php

use Elementor\Utils;

if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly
}
$style = $settings['style'];
$settings = array(
    'query_type' => 'custom_query',
    'post_types' => 'case',
    'posts_per_page' => $settings['posts_per_page'],
    'orderby' => 'date',
    'order' => 'DESC',
);

$query_args = tfl_build_query_args($settings);
$query_args = apply_filters('tfl_posts_case_' . $widget_instance->get_id() . '_query_args', $query_args, $settings);
$loop = new \WP_Query($query_args);
?>
<div class="tfl-case-shortcode <?php echo $style; ?>">
    <?php
    if ($loop->have_posts()) :
        echo '<div class="row">';
        while ($loop->have_posts()) : $loop->the_post();
            $args['post_id'] = get_the_ID();
            $args['current_post'] = $loop->current_post;
            tfl_get_template_part("addons/case/" . $style, $args);
        endwhile;
        echo '</div>';
        wp_reset_postdata();
    endif;
    ?>
</div>