<?php

/**
 * Swatches field
 * 
 */

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

$price_hidden = 'no';
if ( isset( $wpcb_field['field']['price_hidden'] ) && '' !== $wpcb_field['field']['price_hidden'] ) {
	$price_hidden = $wpcb_field['field']['price_hidden'];
}

$class = '';
if ( $wpcb_field_settings['wpcb_swatch_option_style'] == 'none' ) {
	$class .= ' wpcb-swatch-comp';
}
?>
<div class="wpcb-swatch-inner">
	<div class="wpcb-swatch<?php echo $class; ?>">
		<?php echo wp_kses_post( $zoom_html ); ?>
		<?php echo wp_kses_post( $swatch_html ); ?>
	</div>
	<?php
	if ( isset( $wpcb_field['field']['swatch_inline'] ) && is_array( $wpcb_field['field']['swatch_inline'] ) ) {
		echo '<div class="wpcb-option-details">';

		if ( in_array( 'label', $wpcb_field['field']['swatch_inline'] ) ) {
			echo '<p class="wpcb-option-details-label"' . wp_kses_data( $inline_style ) . '>' . esc_attr( $wpcb_option['label'] ) . '</p>';
		}
		
		if ( in_array( 'note', $wpcb_field['field']['swatch_inline'] ) && isset( $wpcb_option['note'] ) && '' !== $wpcb_option['note'] ) {
			echo wp_kses_post( wpcb_get_option_note_html( $wpcb_option ) );
		}

		if ( in_array( 'price', $wpcb_field['field']['swatch_inline'] ) && 'no' === $price_hidden ) {
			wpcb_display_option_price_wrapper_html( $wpcb_option );
		}

		echo '</div>';
	}
	?>
</div>

<?php
echo wp_kses_post( wpcb_get_option_summary_html( $wpcb_option_id, $wpcb_option, $price_hidden ) );
