<?php
/**
 * Page Loader
 *
 * @package Hyper News
 */

$wp_customize->add_section(
	'hyper_news_loader',
	array(
		'title' => esc_html__( 'Page Loader', 'hyper-news' ),
		'panel' => 'hyper_news_theme_options',
	)
);

// Page Loader - Enable loader.
$wp_customize->add_setting(
	'hyper_news_enable_loader',
	array(
		'sanitize_callback' => 'hyper_news_sanitize_switch',
		'default'           => true,
	)
);

$wp_customize->add_control(
	new Hyper_News_Toggle_Switch_Custom_Control(
		$wp_customize,
		'hyper_news_enable_loader',
		array(
			'label'   => esc_html__( 'Enable Loader', 'hyper-news' ),
			'section' => 'hyper_news_loader',
		)
	)
);

// Page Loader - Loader Style.
$wp_customize->add_setting(
	'hyper_news_loader_type',
	array(
		'default'           => 'loader-4',
		'sanitize_callback' => 'hyper_news_sanitize_select',
	)
);

$wp_customize->add_control(
	'hyper_news_loader_type',
	array(
		'label'           => esc_html__( 'Loader Style', 'hyper-news' ),
		'section'         => 'hyper_news_loader',
		'type'            => 'select',
		'choices'         => array(
			'loader-1' => __( 'Style 1', 'hyper-news' ),
			'loader-2' => __( 'Style 2', 'hyper-news' ),
			'loader-3' => __( 'Style 3', 'hyper-news' ),
			'loader-4' => __( 'Style 4', 'hyper-news' ),
			'loader-5' => __( 'Style 5', 'hyper-news' ),
			'loader-6' => __( 'Style 6', 'hyper-news' ),
		),
		'active_callback' => function( $control ) {
			return ( $control->manager->get_setting( 'hyper_news_enable_loader' )->value() );
		},
	)
);
