<?php
/**
 * Customizer active callbacks
 *
 * @package Theme Palace
 * @subpackage Kompany
 * @since Kompany 1.0.0
 */

if ( ! function_exists( 'kompany_is_breadcrumb_enable' ) ) :
	/**
	 * Check if breadcrumb is enabled.
	 *
	 * @since Kompany 1.0.0
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function kompany_is_breadcrumb_enable( $control ) {
		return $control->manager->get_setting( 'kompany_theme_options[breadcrumb_enable]' )->value();
	}
endif;

if ( ! function_exists( 'kompany_is_pagination_enable' ) ) :
	/**
	 * Check if pagination is enabled.
	 *
	 * @since Kompany 1.0.0
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function kompany_is_pagination_enable( $control ) {
		return $control->manager->get_setting( 'kompany_theme_options[pagination_enable]' )->value();
	}
endif;

if ( ! function_exists( 'kompany_is_static_homepage_enable' ) ) :
	/**
	 * Check if static homepage is enabled.
	 *
	 * @since Kompany 1.0.0
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function kompany_is_static_homepage_enable( $control ) {
		return ( 'page' == $control->manager->get_setting( 'show_on_front' )->value() );
	}
endif;

/**
 * Front Page Active Callbacks
 */
/*=================Topbar====================*/
/**
 * Check if topbar menu is enabled.
 *
 * @since Kompany 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function kompany_is_topbar_section_enable( $control ) {
	return ( $control->manager->get_setting( 'kompany_theme_options[topbar_section_enable]' )->value() );
}


/*=================Header Content====================*/
/**
 * Check if header_content is enabled.
 *
 * @since Kompany 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function kompany_is_header_content_section_enable( $control ) {
	return ( $control->manager->get_setting( 'kompany_theme_options[header_content_section_enable]' )->value() );
}

/*==================About=====================*/

/**
 * Check if about section is enabled.
 *
 * @since Kompany 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function kompany_is_about_section_enable( $control ) {
	return ( $control->manager->get_setting( 'kompany_theme_options[about_section_enable]' )->value() );
}

/*==================CTA=====================*/

/**
 * Check if cta section is enabled.
 *
 * @since Kompany 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function kompany_is_cta_section_enable( $control ) {
	return ( $control->manager->get_setting( 'kompany_theme_options[cta_section_enable]' )->value() );
}

/*==================Special=====================*/

/**
 * Check if special section is enabled.
 *
 * @since Kompany 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function kompany_is_special_section_enable( $control ) {
	return ( $control->manager->get_setting( 'kompany_theme_options[special_section_enable]' )->value() );
}

/*===============Team======================*/

/**
 * Check if team section is enabled.
 *
 * @since Kompany 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function kompany_is_team_section_enable( $control ) {
	return ( $control->manager->get_setting( 'kompany_theme_options[team_section_enable]' )->value() );
}

/*==================Contact=====================*/

/**
 * Check if contact section is enabled.
 *
 * @since Kompany 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function kompany_is_contact_section_enable( $control ) {
	return ( $control->manager->get_setting( 'kompany_theme_options[contact_section_enable]' )->value() );
}

/*=========================Latest Blog==================*/

/**
 * Check if latest_blog section is enabled.
 *
 * @since Kompany 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function kompany_is_latest_blog_section_enable( $control ) {
	return ( $control->manager->get_setting( 'kompany_theme_options[latest_blog_section_enable]' )->value() );
}

/**
 * Check if latest_blog section content type is category.
 *
 * @since Kompany 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function kompany_is_latest_blog_section_content_category_enable( $control ) {
	$content_type = $control->manager->get_setting( 'kompany_theme_options[latest_blog_content_type]' )->value();
	return kompany_is_latest_blog_section_enable( $control ) && ( 'category' == $content_type );
}

/**
 * Check if latest_blog section content type is post.
 *
 * @since Kompany 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function kompany_is_latest_blog_section_content_post_enable( $control ) {
	$content_type = $control->manager->get_setting( 'kompany_theme_options[latest_blog_content_type]' )->value();
	return kompany_is_latest_blog_section_enable( $control ) && ( 'post' == $content_type );
}

/*=====================Service====================*/

/**
* Check if service section is enabled.
*
* @since Kompany 1.0.0
* @param WP_Customize_Control $control WP_Customize_Control instance.
* @return bool Whether the control is active to the current preview.
*/
function kompany_is_service_section_enable( $control ) {
	return ( $control->manager->get_setting( 'kompany_theme_options[service_section_enable]' )->value() );
}