<?php
/**
 * The template for displaying testimonial items
 *
 * @package Signify
 */

$signify_enable = get_theme_mod( 'signify_testimonial_option', 'disabled' );

if ( ! signify_check_section( $signify_enable ) ) {
	// Bail if featured content is disabled
	return;
}

$signify_type = get_theme_mod( 'signify_testimonial_type', 'category' );

$signify_classes[] = 'section testimonial-content-section';
$signify_classes[] = $signify_type;

$signify_sub_title   = get_theme_mod( 'signify_testimonial_sub_title' );
$signify_title       = get_theme_mod( 'signify_testimonial_title' );
$signify_description = get_theme_mod( 'signify_testimonial_description' );

if ( 'jetpack-testimonial' === $signify_type ) {
	// Get Jetpack options for testimonial.
	$signify_title       = get_option( 'jetpack_testimonial_title', esc_html__( 'Testimonial', 'signify-pro' ) );
	$signify_description = get_option( 'jetpack_testimonial_content' );
}

if ( ! $signify_sub_title && ! $signify_title && ! $signify_description ) {
	$classes[] = 'no-section-heading';
}

$background_image = get_theme_mod( 'signify_testimonial_bg_image' );

if( $background_image && ( 'tune' === get_theme_mod( 'color_scheme' ) ) ) {
	$signify_classes[] = 'has-background-image';
} 

if ( ! get_theme_mod( 'signify_testimonial_dots', 1 ) ) {
	$signify_classes[] = 'nav-dots-disabled';
}
?>

<div id="testimonial-content-section" class="<?php echo esc_attr( implode( ' ', $signify_classes ) ); ?>">
	<div class="wrapper">
		<?php signify_section_header( $signify_sub_title, $signify_title, $signify_description ); ?>

		<?php
		if ( 'post' === $signify_type || 'jetpack-testimonial' === $signify_type || 'page' === $signify_type || 'category' === $signify_type || 'tag' === $signify_type ) {
			get_template_part( 'template-parts/testimonial/post-types-testimonial' );
		} elseif ( 'custom' === $signify_type ) {
			get_template_part( 'template-parts/testimonial/custom-testimonial' );
		}
	?>
	</div><!-- .wrapper -->
</div><!-- .testimonial-content-section -->
