<?php
if ( ! defined( 'ABSPATH' ) ) {
	// Exit if accessed directly.
	exit;
}
$badge_type = get_post_meta( $badge_id, 'qode_badges_for_woocommerce_badge_type', true );
$badge_type = empty( $badge_type ) ? apply_filters( 'qode_badges_for_woocommerce_filter_default_badge_type', '' ) : $badge_type;

$badge_position = get_post_meta( $badge_id, 'qode_badges_for_woocommerce_badge_position', true );
$badge_position = empty( $badge_position ) ? 'on_image' : $badge_position;

$classes_params             = array();
$classes_params['badge_id'] = ! empty( $badge_id ) ? $badge_id : '';
$classes_params['type']     = $badge_type;
$classes_params['position'] = $badge_position;

$additional_classes = array( 'qbfw--show' );

$badge_params = array(
	'badge_id' => $badge_id,
	'type'     => $badge_type,
	'classes'  => qode_badges_for_woocommerce_badge_classes( $classes_params, $additional_classes ),
);

?>
<div class="qbfw-badge-preview-holder" data-badge-id="<?php echo esc_attr( $badge_id ); ?>">
	<div class="qbfw-badge-preview-image-holder">
		<?php
		if ( 'on_image' === $badge_position ) {
			qode_badges_for_woocommerce_badge_html( $badge_id, $badge_params );
		}
		?>
	</div>
	<div class="qbfw-badge-preview-before-title">
		<?php
		if ( 'below_image' === $badge_position ) {
			qode_badges_for_woocommerce_badge_html( $badge_id, $badge_params );
		}
		?>
	</div>
	<div class="qbfw-badge-preview-title-holder">
		<h4><?php esc_html_e( 'Product title', 'qode-badges-for-woocommerce' ); ?></h4>
	</div>
</div>