<?php
/**
 * Customizer callback functions.
 * 
 * Contains callback functions used to render and manage customizer settings and controls.
 *
 * @package Yaatra
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

    if ( ! function_exists( 'yaatra_cb_has_enable_preloader' ) ) :

        /**
         * Check if preloader option is enable or not.
         *
         * @since 1.0.0
         *
         * @param WP_Customize_Control $control WP_Customize_Control instance.
         *
         * @return bool Whether the control is active to the current preview.
         */
        function yaatra_cb_has_enable_preloader( $control ) {
            if ( false !== $control->manager->get_setting( 'yaatra_preloader_enable' )->value() ) {
                return true;
            } else {
                return false;
            }
        }

    endif;


/*---------------------------------- Frontpage Settings Panel Callback ------------------------*/

    if ( ! function_exists( 'yaatra_front_banner_option_active_callback' ) ) :

        /**
         * Check if the banner section is enabled.
         * Determines whether the Banner section is active in the current preview.
         *
         * @since 1.0.0
         *
         * @param WP_Customize_Control $control The WP_Customize_Control instance for the control being checked.
         *
         * @return bool True if the Banner section is enabled, false otherwise.
         */
        function yaatra_front_banner_option_active_callback( $control ) {
            if ( false !== $control->manager->get_setting( 'yaatra_front_banner_option' )->value() ) {
                return true;
            } else {
                return false;
            }
        }
        
    endif;

/*---------------------------------- Innerpage Panel Callback ---------------------------------*/

    if ( ! function_exists( 'yaatra_cb_has_enable_single_posts_related' ) ) :

        /**
         * Check if single posts related section is enable or not.
         *
         * @since 1.0.0
         *
         * @param WP_Customize_Control $control WP_Customize_Control instance.
         *
         * @return bool Whether the control is active to the current preview.
         */
        function yaatra_cb_has_enable_single_posts_related( $control ) {
            if ( false !== $control->manager->get_setting( 'yaatra_enable_related_posts' )->value() ) {
                return true;
            } else {
                return false;
            }
        }

    endif;