<?php
/**
 * Callbacks functions
 *
 * @package kidsvibe
 */

if ( ! function_exists( 'kidsvibe_has_woocommerce' ) ) :
	/**
	 * Check if woocommerce is enabled enabled
	 *
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function kidsvibe_has_woocommerce() {
		return class_exists( 'WooCommerce' ) ? true : false;
	}
endif;

if ( ! function_exists( 'kidsvibe_slider_section_enable' ) ) :
	/**
	 * Check if slider_section section enabled.
	 *
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function kidsvibe_slider_section_enable( $control ) {
		return $control->manager->get_setting( 'kidsvibe_theme_options[enable_slider]' )->value() ? true : false;
	}
endif;

if ( ! function_exists( 'kidsvibe_slider_wave_enable' ) ) :
	/**
	 * Check if slider wave enable.
	 *
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function kidsvibe_slider_wave_enable( $control ) {
		return ( $control->manager->get_setting( 'kidsvibe_theme_options[enable_slider]' )->value() && $control->manager->get_setting( 'kidsvibe_theme_options[enable_slider_wave]' )->value() );
	}
endif;

if ( ! function_exists( 'kidsvibe_service_section_enable' ) ) :
	/**
	 * Check if service_section section enabled.
	 *
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function kidsvibe_service_section_enable( $control ) {
		return $control->manager->get_setting( 'kidsvibe_theme_options[enable_service]' )->value() ? true : false;
	}
endif;

if ( ! function_exists( 'kidsvibe_introduction_section_enable' ) ) :
	/**
	 * Check if introduction_section section enabled.
	 *
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function kidsvibe_introduction_section_enable( $control ) {
		return $control->manager->get_setting( 'kidsvibe_theme_options[enable_introduction]' )->value() ? true : false;
	}
endif;

if ( ! function_exists( 'kidsvibe_team_section_enable' ) ) :
	/**
	 * Check if team_section section enabled.
	 *
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function kidsvibe_team_section_enable( $control ) {
		return $control->manager->get_setting( 'kidsvibe_theme_options[enable_team]' )->value() ? true : false;
	}
endif;

if ( ! function_exists( 'kidsvibe_portfolio_section_enable' ) ) :
	/**
	 * Check if portfolio_section section enabled.
	 *
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function kidsvibe_portfolio_section_enable( $control ) {
		return $control->manager->get_setting( 'kidsvibe_theme_options[enable_portfolio]' )->value() ? true : false;
	}
endif;

if ( ! function_exists( 'kidsvibe_gallery_section_enable' ) ) :
	/**
	 * Check if gallery_section section enabled.
	 *
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function kidsvibe_gallery_section_enable( $control ) {
		return $control->manager->get_setting( 'kidsvibe_theme_options[enable_gallery]' )->value() ? true : false;
	}
endif;

if ( ! function_exists( 'kidsvibe_product_section_enable' ) ) :
	/**
	 * Check if product_section section enabled.
	 *
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function kidsvibe_product_section_enable( $control ) {
		return ( kidsvibe_has_woocommerce() && $control->manager->get_setting( 'kidsvibe_theme_options[enable_product]' )->value() );
	}
endif;

if ( ! function_exists( 'kidsvibe_cta_section_enable' ) ) :
	/**
	 * Check if cta_section section enabled.
	 *
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function kidsvibe_cta_section_enable( $control ) {
		return $control->manager->get_setting( 'kidsvibe_theme_options[enable_cta]' )->value() ? true : false;
	}
endif;

if ( ! function_exists( 'kidsvibe_client_section_enable' ) ) :
	/**
	 * Check if client_section section enabled.
	 *
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function kidsvibe_client_section_enable( $control ) {
		return $control->manager->get_setting( 'kidsvibe_theme_options[enable_client]' )->value() ? true : false;
	}
endif;

if ( ! function_exists( 'kidsvibe_testimonial_section_enable' ) ) :
	/**
	 * Check if testimonial_section section enabled.
	 *
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function kidsvibe_testimonial_section_enable( $control ) {
		return $control->manager->get_setting( 'kidsvibe_theme_options[enable_testimonial]' )->value() ? true : false;
	}
endif;

if ( ! function_exists( 'kidsvibe_recent_section_enable' ) ) :
	/**
	 * Check if recent_section section enabled.
	 *
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function kidsvibe_recent_section_enable( $control ) {
		return $control->manager->get_setting( 'kidsvibe_theme_options[enable_recent]' )->value() ? true : false;
	}
endif;

if ( ! function_exists( 'kidsvibe_recent_content_category_enable' ) ) :
	/**
	 * Check if recent content type is category.
	 *
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function kidsvibe_recent_content_category_enable( $control ) {
		return ( $control->manager->get_setting( 'kidsvibe_theme_options[enable_recent]' )->value() && 'category' == $control->manager->get_setting( 'kidsvibe_theme_options[recent_content_type]' )->value() );
	}
endif;
