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

if ( ! function_exists( 'creamy_bakery_customizer_footer_register' ) ) :
function creamy_bakery_customizer_footer_register( $wp_customize ) {
 	
 	$wp_customize->add_section(
        'creamy_bakery_footer_settings',
        array (
            'priority'      => 30,
            'capability'    => 'edit_theme_options',
            'title'         => esc_html__( 'Footer Settings', 'creamy-bakery' )
        )
    );

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

	$wp_customize->add_control( 
		new Creamy_Bakery_Title_Info_Control( $wp_customize, 'creamy_bakery_label_footer_settings_title', 
		array(
		    'label'       => esc_html__( 'Footer Settings', 'creamy-bakery' ),
		    'section'     => 'creamy_bakery_footer_settings',
		    'type'        => 'creamy-bakery-title',
		    'settings'    => 'creamy_bakery_label_footer_settings_title',
		) 
	));

	// Copyright text
    $wp_customize->add_setting(
        'creamy_bakery_footer_copyright_text',
        array(
            'type' => 'theme_mod',
            'sanitize_callback' => 'creamy_bakery_sanitize_textarea_field'
        )
    );

    $wp_customize->add_control(
        'creamy_bakery_footer_copyright_text',
        array(
            'settings'      => 'creamy_bakery_footer_copyright_text',
            'section'       => 'creamy_bakery_footer_settings',
            'type'          => 'textarea',
            'label'         => esc_html__( 'Footer Copyright Text', 'creamy-bakery' )
        )
    );
}
endif;

add_action( 'customize_register', 'creamy_bakery_customizer_footer_register' );