<?php
/**
 * Footer bottom area fields within the Footer Settings panel.
 * 
 * Provides options for configuring the content and appearance of the footer bottom area.
 *
 * @package Yaatra
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

add_action( 'customize_register', 'yaatra_register_footer_options' );

if ( ! function_exists( 'yaatra_register_footer_options' ) ) :

	function yaatra_register_footer_options( $wp_customize ) {

		/*
         * Failsafe is safe
         */
        if ( ! isset( $wp_customize ) ) {
            return;
        }

        /**
         * Bottom Area Section
         * 
         * Footer Settings
         * 
         * @uses $wp_customize->add_section() https://developer.wordpress.org/reference/classes/wp_customize_manager/add_section/
         * @since 1.0.0
         */
        $wp_customize->add_section( new Yaatra_Customize_Section (
            $wp_customize, 'yaatra_section_footer',
                array(
                    'priority'  => 30,
                    'title'     => __( 'Footer Settings', 'yaatra' ),
                )
            )
        );

		/**
         * Image field for footer logo
         *
         * @since 1.0.0
         */
        $wp_customize->add_setting( 'yaatra_footer_logo_image',
            array(
                'default'           => yaatra_get_customizer_default( 'yaatra_footer_logo_image' ),
                'sanitize_callback' => 'esc_url_raw'
            )
        );
        $wp_customize->add_control( new WP_Customize_Image_Control(
            $wp_customize, 'yaatra_footer_logo_image',
                array(
                    'priority'          => 10,
                    'section'           => 'yaatra_section_footer',
                    'settings'          => 'yaatra_footer_logo_image',
                    'label'             => __( 'Footer Logo', 'yaatra' ),
                    'type'              => 'upload'
                )
            )
        );

        /**
         * Text field for copyright
         *
         * @since 1.0.0
         */
        $wp_customize->add_setting( 'yaatra_copyright_text',
            array(
                'default'           => yaatra_get_customizer_default( 'yaatra_copyright_text' ),
                'sanitize_callback' => 'wp_kses_post',
            )
        );
        $wp_customize->add_control( 'yaatra_copyright_text',
            array(
                'priority'      => 20,
                'section'       => 'yaatra_section_footer',
                'settings'      => 'yaatra_copyright_text',
                'label'         => __( 'Copyright Text', 'yaatra' ),
                'type'          => 'text',
            )
        );

	}

endif;

