<?php
/**
 * General Settings
 *
 * Register General section, settings and controls for Theme Customizer
 *
 * @package cleanead
 */
/**
 * Adds all general settings to the Customizer
 *
 * @param object $wp_customize / Customizer Object
 */
function cleanead_customize_register_general_options( $wp_customize ) {
// Add Section for Theme Options
	$wp_customize->add_section( 'cleanead_section_general', array(
        'title'    => esc_html__( 'General Settings', 'cleanead' ),
        'priority' => 10,
		'panel' => 'cleanead_options_panel' 
		)
	);

	// Add Settings and Controls for Layout
	$wp_customize->add_setting( 'cleanead_theme_options[layout]', array(
        'default'           => 'right-sidebar',
		'type'           	=> 'option',
        'transport'         => 'refresh',
        'sanitize_callback' => 'cleanead_sanitize_select'
		)
	);

    $wp_customize->add_control( 'cleanead_theme_options[layout]', array(
        'label'    => esc_html__( 'Theme Layout', 'cleanead' ),
        'section'  => 'cleanead_section_general',
        'settings' => 'cleanead_theme_options[layout]',
        'type'     => 'radio',
		'priority' => 1,
        'choices'  => array(
            'left-sidebar' => esc_html__( 'Left Sidebar', 'cleanead' ),
            'right-sidebar' => esc_html__( 'Right Sidebar', 'cleanead' )
			)
		)
	);

	// Add Sticky Header Setting
	$wp_customize->add_setting( 'cleanead_theme_options[sticky_header_title]', array(
        'default'           => '',
		'type'           	=> 'option',
        'transport'         => 'refresh',
        'sanitize_callback' => 'esc_attr'
        )
    );
    $wp_customize->add_control( new cleanead_Customize_Header_Control(
        $wp_customize, 'cleanead_theme_options[sticky_header_title]', array(
            'label' => esc_html__( 'Sticky Header', 'cleanead' ),
            'section' => 'cleanead_section_general',
            'settings' => 'cleanead_theme_options[sticky_header_title]',
            'priority' => 2
            )
        )
    );

    $wp_customize->add_setting( 'cleanead_theme_options[sticky_header]', array(
        'default'           => false,
		'type'           	=> 'option',
        'transport'         => 'refresh',
        'sanitize_callback' => 'cleanead_sanitize_checkbox'
		)
	);
    $wp_customize->add_control( 'cleanead_theme_options[sticky_header]', array(
        'label'    => esc_html__( 'Enable sticky header feature', 'cleanead' ),
        'section'  => 'cleanead_section_general',
        'settings' => 'cleanead_theme_options[sticky_header]',
        'type'     => 'checkbox',
		'priority' => 3
		)
	);
}
add_action( 'customize_register', 'cleanead_customize_register_general_options' );