<?php
/**
 * Theme Customizer Controls
 *
 * @package Creamy Bakery
 */

if ( ! function_exists( 'creamy_bakery_customizer_global_color_setting_register' ) ) :
function creamy_bakery_customizer_global_color_setting_register( $wp_customize ) {
 
 	$wp_customize->add_section(
        'creamy_bakery_global_color_settings',
        array (
            'priority'      => 40,
            'capability'    => 'edit_theme_options',
            'title'         => esc_html__( 'Global Color Settings', 'creamy-bakery' )
        )
    );

    // Title label
	$wp_customize->add_setting( 
		'creamy_bakery_theme_color_settings', 
		array(
		    'sanitize_callback' => 'creamy_bakery_sanitize_title',
		) 
	);

	$wp_customize->add_control( 
		new Creamy_Bakery_Title_Info_Control( $wp_customize, 'creamy_bakery_theme_color_settings', 
		array(
		    'label'       => esc_html__( 'Global Color Settings', 'creamy-bakery' ),
		    'section'     => 'creamy_bakery_global_color_settings',
		    'type'        => 'creamy-bakery-title',
		    'settings'    => 'creamy_bakery_theme_color_settings',
		) 
	));

	$wp_customize->add_setting('creamy_bakery_global_color1',
        array(
            'type' => 'theme_mod',
            'default'           => '#cb75b7',
            'sanitize_callback' => 'sanitize_hex_color'
        )
    );

    $wp_customize->add_control(
        new WP_Customize_Color_Control(
            $wp_customize,
            'creamy_bakery_global_color1',
            array(
                'label'      => esc_html__( 'Global Color1', 'creamy-bakery' ),
                'section'    => 'creamy_bakery_global_color_settings',
                'settings'   => 'creamy_bakery_global_color1',
            )
        )
    );   

}
endif;

add_action( 'customize_register', 'creamy_bakery_customizer_global_color_setting_register' );