<?php
/**
 * The template for displaying stats content
 *
 * @package Signify Pro
 */
?>

<?php

$enable_content = get_theme_mod( 'signify_stats_option', 'disabled' );

if ( ! signify_check_section( $enable_content ) ) {
	// Bail if stats content is disabled.
	return;
}

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

$layout = get_theme_mod( 'signify_stats_layout', 'layout-four' );

$classes[] = 'stats-section';
$classes[] = 'section';

$signify_sub_title   = get_theme_mod( 'signify_stats_sub_title' );
$signify_title       = get_theme_mod( 'signify_stats_title' );
$signify_description = get_theme_mod( 'signify_stats_description' );

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

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

			<div class="section-content-wrapper stats-content-wrapper <?php echo esc_attr( $layout ); ?>">

				<?php
				if ( 'custom' === $signify_type ) {
					get_template_part( 'template-parts/stats/content-custom' );
				} else {
					get_template_part( 'template-parts/stats/content-stats' );
				}
				?>

				<?php
					$target = get_theme_mod( 'signify_stats_target' ) ? '_blank': '_self';
					$signify_link   = get_theme_mod( 'signify_stats_link', '#' );
					$text   = get_theme_mod( 'signify_stats_text' );

					if ( $text ) :
				?>
				<p class="view-more">
					<a class="more-link" target="<?php echo $target; ?>" href="<?php echo esc_url( $signify_link ); ?>"><?php echo esc_html( $text ); ?></a>
				</p>
				<?php endif; ?>
			</div><!-- .section-content-wrapper -->
	</div><!-- .wrapper -->
</div><!-- #stats-section -->
