<?php
/**
 * Footer options
 *
 * @package Theme Palace
 * @subpackage Enlightme
 * @since Enlightme 1.0.0
 */

// Footer Section
$wp_customize->add_section( 'enlightme_section_footer',
	array(
		'title'      			=> esc_html__( 'Footer Options', 'enlightme' ),
		'priority'   			=> 900,
		'panel'      			=> 'enlightme_theme_options_panel',
	)
);

// footer text
$wp_customize->add_setting( 'enlightme_theme_options[footer_text]',
	array(
		'sanitize_callback'		=> 'sanitize_text_field',
		'transport'				=> 'postMessage',
	)
);

$wp_customize->add_control( 'enlightme_theme_options[footer_text]',
    array(
		'label'      			=> esc_html__( 'Foote Info Text', 'enlightme' ),
		'section'    			=> 'enlightme_section_footer',
		'type'		 			=> 'text',
    )
);

// Abort if selective refresh is not available.
if ( isset( $wp_customize->selective_refresh ) ) {
    $wp_customize->selective_refresh->add_partial( 'enlightme_theme_options[footer_text]', array(
		'selector'            => '#colophon h2.section-title',
		'settings'            => 'enlightme_theme_options[footer_text]',
		'container_inclusive' => false,
		'fallback_refresh'    => true,
		'render_callback'     => 'enlightme_footer_text_partial',
    ) );
}

// featured title setting and control
$wp_customize->add_setting( 'enlightme_theme_options[footer_btn_title]', array(
	'sanitize_callback' => 'sanitize_text_field',
	'default'			=> $options['footer_btn_title'],
	'transport'			=> 'postMessage',
) );

$wp_customize->add_control( 'enlightme_theme_options[footer_btn_title]', array(
	'label'           	=> esc_html__( 'Footer Btn Label', 'enlightme' ),
	'section'        	=> 'enlightme_section_footer',
	'type'				=> 'text',
) );

// Abort if selective refresh is not available.
if ( isset( $wp_customize->selective_refresh ) ) {
    $wp_customize->selective_refresh->add_partial( 'enlightme_theme_options[footer_btn_title]', array(
		'selector'            => '#colophon .read-more a.btn',
		'settings'            => 'enlightme_theme_options[footer_btn_title]',
		'container_inclusive' => false,
		'fallback_refresh'    => true,
		'render_callback'     => 'enlightme_footer_btn_title_partial',
    ) );
}

// blog btn title setting and control
$wp_customize->add_setting( 'enlightme_theme_options[footer_btn_url]', array(
	'sanitize_callback' => 'esc_url_raw',
) );

$wp_customize->add_control( 'enlightme_theme_options[footer_btn_url]', array(
	'label'           	=> esc_html__( 'Button Url', 'enlightme' ),
	'section'        	=> 'enlightme_section_footer',
	'type'				=> 'url',
) );

// footer image setting and control.
$wp_customize->add_setting( 'enlightme_theme_options[footer_logo]', array(
	'sanitize_callback' => 'enlightme_sanitize_image'
	) );

$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'enlightme_theme_options[footer_logo]',
	array(
		'label'       		=> esc_html__( 'Site Footer Logo', 'enlightme' ),
		'section'     		=> 'enlightme_section_footer',
		) ) );

// footer copyright text
$wp_customize->add_setting( 'enlightme_theme_options[copyright_text]',
	array(
		'default'       		=> $options['copyright_text'],
		'sanitize_callback'		=> 'enlightme_santize_allow_tag',
		'transport'				=> 'postMessage',
	)
);
$wp_customize->add_control( 'enlightme_theme_options[copyright_text]',
    array(
		'label'      			=> esc_html__( 'Copyright Text', 'enlightme' ),
		'section'    			=> 'enlightme_section_footer',
		'type'		 			=> 'textarea',
    )
);

// Abort if selective refresh is not available.
if ( isset( $wp_customize->selective_refresh ) ) {
    $wp_customize->selective_refresh->add_partial( 'enlightme_theme_options[copyright_text]', array(
		'selector'            => '#colophon .site-info span.copyright',
		'settings'            => 'enlightme_theme_options[copyright_text]',
		'container_inclusive' => false,
		'fallback_refresh'    => true,
		'render_callback'     => 'enlightme_copyright_text_partial',
    ) );
}

// scroll top visible
$wp_customize->add_setting( 'enlightme_theme_options[scroll_top_visible]',
	array(
		'default'       		=> $options['scroll_top_visible'],
		'sanitize_callback' => 'enlightme_sanitize_switch_control',
	)
);
$wp_customize->add_control( new Enlightme_Switch_Control( $wp_customize, 'enlightme_theme_options[scroll_top_visible]',
    array(
		'label'      			=> esc_html__( 'Display Scroll Top Button', 'enlightme' ),
		'section'    			=> 'enlightme_section_footer',
		'on_off_label' 		=> enlightme_switch_options(),
    )
) );