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

<?php
$enable_content = get_theme_mod( 'signify_service_option', 'disabled' );

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

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

$signify_sub_title   = get_theme_mod( 'signify_service_sub_title' );
$signify_title       = get_theme_mod( 'signify_service_title' );
$signify_description = get_theme_mod( 'signify_service_description' );

if ( 'ect-service' === $signify_type ) {
	$signify_title = get_option( 'ect_service_title', esc_html__( 'Services', 'signify-pro' ) );
	$sub_title     = get_option( 'ect_service_content' );
}

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

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

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

		<?php
		$wrapper_classes[] = 'section-content-wrapper service-content-wrapper';

		$wrapper_classes[] = get_theme_mod( 'signify_service_layout', 'layout-three' );
		?>

		<div class="<?php echo esc_attr( implode( ' ', $wrapper_classes ) ); ?>">
			<?php
			if ( 'custom' === $signify_type ) {
				get_template_part( 'template-parts/service/content-custom' );
			} else {
				get_template_part( 'template-parts/service/content-service' );
			}
			?>

			<?php
				$target       = get_theme_mod( 'signify_service_target' ) ? '_blank': '_self';
				$signify_link = get_theme_mod( 'signify_service_link', '#' );
				$text         = get_theme_mod( 'signify_service_text' );

				if ( $text ) :
			?>

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