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

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

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

/**
 * Front Page Active Callbacks
 */

/*=========================hero banner=====================*/

/**
 * Check if hero_banner section is enabled.
 *
 * @since Newstation 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function newstation_is_hero_banner_section_enable( $control ) {
	return ( $control->manager->get_setting( 'newstation_theme_options[hero_banner_section_enable]' )->value() );
}

/*==========================breaking news=====================*/

/**
 * Check if breakingnews section is enabled.
 *
 * @since Newstation 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function newstation_is_breakingnews_section_enable( $control ) {
	return ( $control->manager->get_setting( 'newstation_theme_options[breakingnews_section_enable]' )->value() );
}

/*=================Header Posts===============*/

/**
 * Check if featured_news section is enabled.
 *
 * @since Newstation 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function newstation_is_featured_news_section_enable( $control ) {
	return ( $control->manager->get_setting( 'newstation_theme_options[featured_news_section_enable]' )->value() );
}

/*=========================Top Politician===========================*/

/**
 * Check if top_politician section is enabled.
 *
 * @since Newstation 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function newstation_is_top_politician_section_enable( $control ) {
	return ( $control->manager->get_setting( 'newstation_theme_options[top_politician_section_enable]' )->value() );
}

/*=========================World News=====================*/

/**
 * Check if world_news section is enabled.
 *
 * @since Newstation 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function newstation_is_world_news_section_enable( $control ) {
	return ( $control->manager->get_setting( 'newstation_theme_options[world_news_section_enable]' )->value() );
}

/*=========================Business News=====================*/

/**
 * Check if business_news section is enabled.
 *
 * @since Newstation 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function newstation_is_business_news_section_enable( $control ) {
	return ( $control->manager->get_setting( 'newstation_theme_options[business_news_section_enable]' )->value() );
}

/*=========================Sports News=====================*/

/**
 * Check if sports_news section is enabled.
 *
 * @since Newstation 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function newstation_is_sports_news_section_enable( $control ) {
	return ( $control->manager->get_setting( 'newstation_theme_options[sports_news_section_enable]' )->value() );
}

/*=================blog========================*/

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

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

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