<?php
/**
 * Theme Customizer Controls
 *
 * @package pawwell
 */

defined( 'ABSPATH' ) || exit;


if ( ! function_exists( 'pawwell_customizer_preloader_settings_register' ) ) :
function pawwell_customizer_preloader_settings_register( $wp_customize ) {

 	/**
     * Preloader Settings Section
     */
    $wp_customize->add_section(
        'pawwell_preloader_settings',
        array(
            'priority'   => 20,
            'capability' => 'edit_theme_options',
            'title'      => esc_html__( 'Preloader Settings', 'pawwell' ),
        )
    );

    // Title label - Preloader
    $wp_customize->add_setting(
        'pawwell_preloader_label',
        array(
            'sanitize_callback' => 'pawwell_sanitize_title',
        )
    );

    $wp_customize->add_control(
        new Pawwell_Title_Info_Control( $wp_customize, 'pawwell_preloader_label',
        array(
            'label'    => esc_html__( 'Preloader Settings', 'pawwell' ),
            'section'  => 'pawwell_preloader_settings',
            'type'     => 'pawwell-title',
            'settings' => 'pawwell_preloader_label',
        )
    ));

    // Enable/Disable Preloader
    $wp_customize->add_setting(
        'pawwell_enable_preloader',
        array(
            'default'           => true,
            'type'              => 'theme_mod',
            'sanitize_callback' => 'pawwell_sanitize_checkbox',
            'transport'         => 'refresh',
        )
    );

    $wp_customize->add_control(
        new Pawwell_Toggle_Control( $wp_customize, 'pawwell_enable_preloader',
        array(
            'label'       => esc_html__( 'Enable Preloader', 'pawwell' ),
            'section'     => 'pawwell_preloader_settings',
            'type'        => 'pawwell-toggle',
            'settings'    => 'pawwell_enable_preloader',
        )
    ));
}
endif;

add_action( 'customize_register', 'pawwell_customizer_preloader_settings_register' );