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

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

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

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

/**
 * Front Page Active Callbacks
 */

/*=====================topbar================*/
/**
 * Check if topbar section is enabled.
 *
 * @since Enlightme 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function enlightme_is_topbar_section_enable( $control ) {
	return ( $control->manager->get_setting( 'enlightme_theme_options[topbar_section_enable]' )->value() );
}

/**
 * Check if topbar section is enabled.
 *
 * @since Enlightme 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function enlightme_is_topbar_btn_enable( $control ) {
	return ( $control->manager->get_setting( 'enlightme_theme_options[topbar_btn]' )->value() );
}

/*========================slider====================*/

/**
 * Check if slider section is enabled.
 *
 * @since Enlightme 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function enlightme_is_slider_section_enable( $control ) {

	return $control->manager->get_setting( 'enlightme_theme_options[slider_section_enable]' )->value() ;
}

/*===========================service==================*/

/**
 * Check if service section is enabled.
 *
 * @since Enlightme 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function enlightme_is_service_section_enable( $control ) {

	return $control->manager->get_setting( 'enlightme_theme_options[service_section_enable]' )->value() ;
}

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

/*=======================subscription=========================*/

function enlightme_is_subscription_section_enable( $control ) {
	return $control->manager->get_setting( 'enlightme_theme_options[subscription_section_enable]' )->value();
}

/*=======================blog=========================*/
/**
 * Check if blog section is enabled.
 *
 * @since Enlightme 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function enlightme_is_blog_section_enable( $control ) {
	return ( $control->manager->get_setting( 'enlightme_theme_options[blog_section_enable]' )->value() );
}

/**
 * Check if blog section content type is category.
 *
 * @since Enlightme 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function enlightme_is_blog_section_content_category_enable( $control ) {
	$content_type = $control->manager->get_setting( 'enlightme_theme_options[blog_content_type]' )->value();
	return enlightme_is_blog_section_enable( $control ) && ( 'category' == $content_type );
}

/**
 * Check if blog section content type is post.
 *
 * @since Enlightme 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function enlightme_is_blog_section_content_post_enable( $control ) {
	$content_type = $control->manager->get_setting( 'enlightme_theme_options[blog_content_type]' )->value();
	return enlightme_is_blog_section_enable( $control ) && ( 'post' == $content_type );
}

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

/**
 * Check if team section content type is page.
 *
 * @since Enlightme 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function enlightme_is_team_section_content_page_enable( $control ) {
	$content_type = $control->manager->get_setting( 'enlightme_theme_options[team_content_type]' )->value();
	return enlightme_is_team_section_enable( $control ) && ( 'page' == $content_type );
}

function enlightme_is_team_section_content_position_social_enable( $control ) {
	$content_type = $control->manager->get_setting( 'enlightme_theme_options[team_content_type]' )->value();
	return enlightme_is_team_section_enable( $control ) && ( 'page' == $content_type );
}

/**
 * Check if team section content type is page.
 *
 * @since Enlightme 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function enlightme_is_team_section_content_team_enable( $control ) {
	$content_type = $control->manager->get_setting( 'enlightme_theme_options[team_content_type]' )->value();
	return enlightme_is_team_section_enable( $control ) && ( 'tp-team' == $content_type );
}

/*============================featured===================*/
/**
 * Check if featured section is enabled.
 *
 * @since Enlightme 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function enlightme_is_featured_section_enable( $control ) {

	return $control->manager->get_setting( 'enlightme_theme_options[featured_section_enable]' )->value() ;
}


/*===============client=======================*/
/**
 * Check if client section is enabled.
 *
 * @since Enlightme 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function enlightme_is_client_section_enable( $control ) {
	return ( $control->manager->get_setting( 'enlightme_theme_options[client_section_enable]' )->value() );
}

/*====================sortable=================*/

//pro layout 
function enlightme_is_default_layout( $control ) {
	$design = $control->manager->get_setting( 'enlightme_theme_options[home_layout]' )->value();
	return ( 'default-design' == $design );
}

//second layout 
function enlightme_is_second_layout( $control ) {
	$design = $control->manager->get_setting( 'enlightme_theme_options[home_layout]' )->value();
	return ( 'second-design' == $design );
}

//third layout 
function enlightme_is_third_layout( $control ) {
	$design = $control->manager->get_setting( 'enlightme_theme_options[home_layout]' )->value();
	return ( 'third-design' == $design );
}

//fourth layout 
function enlightme_is_fourth_layout( $control ) {
	$design = $control->manager->get_setting( 'enlightme_theme_options[home_layout]' )->value();
	return ( 'fourth-design' == $design );
}

//fifth layout 
function enlightme_is_fifth_layout( $control ) {
	$design = $control->manager->get_setting( 'enlightme_theme_options[home_layout]' )->value();
	return ( 'fifth-design' == $design );
}