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

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

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

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

if ( ! function_exists( 'kiddiz_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 kiddiz_slider_section_enable( $control ) {
		return $control->manager->get_setting( 'kiddiz_theme_options[enable_slider]' )->value() ? true : false;
	}
endif;

if ( ! function_exists( 'kiddiz_short_cta_section_enable' ) ) :
	/**
	 * Check if short_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 kiddiz_short_cta_section_enable( $control ) {
		return $control->manager->get_setting( 'kiddiz_theme_options[enable_short_cta]' )->value() ? true : false;
	}
endif;

if ( ! function_exists( 'kiddiz_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 kiddiz_service_section_enable( $control ) {
		return $control->manager->get_setting( 'kiddiz_theme_options[enable_service]' )->value() ? true : false;
	}
endif;

if ( ! function_exists( 'kiddiz_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 kiddiz_introduction_section_enable( $control ) {
		return $control->manager->get_setting( 'kiddiz_theme_options[enable_introduction]' )->value() ? true : false;
	}
endif;

if ( ! function_exists( 'kiddiz_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 kiddiz_team_section_enable( $control ) {
		return $control->manager->get_setting( 'kiddiz_theme_options[enable_team]' )->value() ? true : false;
	}
endif;

if ( ! function_exists( 'kiddiz_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 kiddiz_portfolio_section_enable( $control ) {
		return $control->manager->get_setting( 'kiddiz_theme_options[enable_portfolio]' )->value() ? true : false;
	}
endif;

if ( ! function_exists( 'kiddiz_portfolio_content_post_enable' ) ) :
	/**
	 * Check if portfolio content type is post.
	 *
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function kiddiz_portfolio_content_post_enable( $control ) {
		return ( $control->manager->get_setting( 'kiddiz_theme_options[enable_portfolio]' )->value() && 'post' == $control->manager->get_setting( 'kiddiz_theme_options[portfolio_content_type]' )->value() );
	}
endif;

if ( ! function_exists( 'kiddiz_portfolio_content_product_enable' ) ) :
	/**
	 * Check if portfolio content type is product.
	 *
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function kiddiz_portfolio_content_product_enable( $control ) {
		return ( $control->manager->get_setting( 'kiddiz_theme_options[enable_portfolio]' )->value() && 'product' == $control->manager->get_setting( 'kiddiz_theme_options[portfolio_content_type]' )->value() );
	}
endif;

if ( ! function_exists( 'kiddiz_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 kiddiz_cta_section_enable( $control ) {
		return $control->manager->get_setting( 'kiddiz_theme_options[enable_cta]' )->value() ? true : false;
	}
endif;

if ( ! function_exists( 'kiddiz_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 kiddiz_recent_section_enable( $control ) {
		return $control->manager->get_setting( 'kiddiz_theme_options[enable_recent]' )->value() ? true : false;
	}
endif;

if ( ! function_exists( 'kiddiz_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 kiddiz_recent_content_category_enable( $control ) {
		return ( $control->manager->get_setting( 'kiddiz_theme_options[enable_recent]' )->value() && 'category' == $control->manager->get_setting( 'kiddiz_theme_options[recent_content_type]' )->value() );
	}
endif;
