<?php
/**
 * Footer Options
 *
 * @package handmade_craft
 */

$wp_customize->add_section(
	'handmade_craft_footer_options',
	array(
		'panel' => 'handmade_craft_theme_options',
		'title' => esc_html__( 'Footer Options', 'handmade-craft' ),
	)
);

// Add Separator Custom Control
$wp_customize->add_setting( 'handmade_craft_footer_separators', array(
	'sanitize_callback' => 'sanitize_text_field',
) );

$wp_customize->add_control( new Handmade_Craft_Separator_Custom_Control( $wp_customize, 'handmade_craft_footer_separators', array(
	'label' => __( 'Footer Settings', 'handmade-craft' ),
	'section' => 'handmade_craft_footer_options',
	'settings' => 'handmade_craft_footer_separators',
)));

// Footer Section - Enable Section.
$wp_customize->add_setting(
	'handmade_craft_enable_footer_section',
	array(
		'default'           => true,
		'sanitize_callback' => 'handmade_craft_sanitize_switch',
	)
);

$wp_customize->add_control(
	new Handmade_Craft_Toggle_Switch_Custom_Control(
		$wp_customize,
		'handmade_craft_enable_footer_section',
		array(
			'label'    => esc_html__( 'Show / Hide Footer', 'handmade-craft' ),
			'section'  => 'handmade_craft_footer_options',
			'settings' => 'handmade_craft_enable_footer_section',
		)
	)
);

// column // 
$wp_customize->add_setting(
	'handmade_craft_footer_widget_column',
	array(
        'default'			=> '4',
		'capability'     	=> 'edit_theme_options',
		'sanitize_callback' => 'handmade_craft_sanitize_select',
		
	)
);	

$wp_customize->add_control(
	'handmade_craft_footer_widget_column',
	array(
	    'label'   		=> __('Select Widget Column','handmade-craft'),
		'description' => __('Note: Default footer widgets are shown. Add your preferred widgets in (Appearance > Widgets > Footer) to see changes.', 'handmade-craft'),
	    'section' 		=> 'handmade_craft_footer_options',
		'type'			=> 'select',
		'choices'        => 
		array(
			'' => __( 'None', 'handmade-craft' ),
			'1' => __( '1 Column', 'handmade-craft' ),
			'2' => __( '2 Column', 'handmade-craft' ),
			'3' => __( '3 Column', 'handmade-craft' ),
			'4' => __( '4 Column', 'handmade-craft' )
		) 
	) 
);

//  BG Color // 
$wp_customize->add_setting('footer_background_color_setting', array(
    'default' => '#000',
    'sanitize_callback' => 'sanitize_hex_color',
));

$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'footer_background_color_setting', array(
    'label' => __('Footer Background Color', 'handmade-craft'),
    'section' => 'handmade_craft_footer_options',
)));

// Footer Background Image Setting
$wp_customize->add_setting('footer_background_image_setting', array(
    'default' => '',
    'sanitize_callback' => 'esc_url_raw',
));

$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'footer_background_image_setting', array(
    'label' => __('Footer Background Image', 'handmade-craft'),
    'section' => 'handmade_craft_footer_options',
)));

// Footer Background Attachment
$wp_customize->add_setting(
	'handmade_craft_footer_image_attachment_setting',
	array(
		'default'=> 'scroll',
		'sanitize_callback' => 'handmade_craft_sanitize_choices'
	)
);

$wp_customize->add_control(
	'handmade_craft_footer_image_attachment_setting',
	array(
		'type' => 'select',
		'label' => __('Footer Background Attatchment','handmade-craft'),
		'choices' => array(
			'fixed' => __('fixed','handmade-craft'),
			'scroll' => __('scroll','handmade-craft'),
		),
		'section'=> 'handmade_craft_footer_options',
  	)
);

//Footer Image Position
$wp_customize->add_setting(
	'handmade_craft_footer_img_position_setting',
	array(
        'default'			=> 'center center',
		'capability'     	=> 'edit_theme_options',
		'sanitize_callback' => 'handmade_craft_sanitize_choices',
		
	)
);	

$wp_customize->add_control(
	'handmade_craft_footer_img_position_setting',
	array(
		'label'   		=> __('Footer Image Position','handmade-craft'),
	    'section' 		=> 'handmade_craft_footer_options',
		'type'			=> 'select',
		'choices'       => 
		array(
			'center center'   => __( 'Center', 'handmade-craft' ),
			'center top'   	  => __( 'Top', 'handmade-craft' ),
			'center bottom'   => __( 'Bottom', 'handmade-craft' ),
		) 
	) 
);

$wp_customize->add_setting('footer_text_transform', array(
    'default' => 'none',
    'sanitize_callback' => 'sanitize_text_field',
));

// Add Footer Text Transform Control
$wp_customize->add_control('footer_text_transform', array(
    'label' => __('Footer Heading Text Transform', 'handmade-craft'),
    'section' => 'handmade_craft_footer_options',
    'settings' => 'footer_text_transform',
    'type' => 'select',
    'choices' => array(
        'none' => __('None', 'handmade-craft'),
        'capitalize' => __('Capitalize', 'handmade-craft'),
        'uppercase' => __('Uppercase', 'handmade-craft'),
        'lowercase' => __('Lowercase', 'handmade-craft'),
    ),
));

// Footer Heading Alignment
$wp_customize->add_setting(
	'handmade_craft_footer_header_align',
	array(
		'default' 			=> 'left',
		'sanitize_callback' => 'sanitize_text_field'
	)
);

$wp_customize->add_control(
	'handmade_craft_footer_header_align',
	array(
		'label' => __('Footer Heading Alignment ','handmade-craft'),
		'section' => 'handmade_craft_footer_options',
		'type'			=> 'select',
		'choices' => 
		array(
			'left' => __('Left','handmade-craft'),
			'right' => __('Right','handmade-craft'),
			'center' => __('Center','handmade-craft'),
		),
	)
);

// Add Separator Custom Control
$wp_customize->add_setting( 'handmade_craft_copyright_separators', array(
	'sanitize_callback' => 'sanitize_text_field',
) );

$wp_customize->add_control( new Handmade_Craft_Separator_Custom_Control( $wp_customize, 'handmade_craft_copyright_separators', array(
	'label' => __( 'Copyright Settings', 'handmade-craft' ),
	'section' => 'handmade_craft_footer_options',
	'settings' => 'handmade_craft_copyright_separators',
)));

// Copyright Section - Enable Section.
$wp_customize->add_setting(
	'handmade_craft_enable_copyright_section',
	array(
		'default'           => true,
		'sanitize_callback' => 'handmade_craft_sanitize_switch',
	)
);

$wp_customize->add_control(
	new Handmade_Craft_Toggle_Switch_Custom_Control(
		$wp_customize,
		'handmade_craft_enable_copyright_section',
		array(
			'label'    => esc_html__( 'Show / Hide Copyright', 'handmade-craft' ),
			'section'  => 'handmade_craft_footer_options',
			'settings' => 'handmade_craft_enable_copyright_section',
		)
	)
);

$wp_customize->add_setting(
	'handmade_craft_footer_copyright_text',
	array(
		'default'           => '',
		'sanitize_callback' => 'wp_kses_post',
		'transport'         => 'refresh',
	)
);

$wp_customize->add_control(
	'handmade_craft_footer_copyright_text',
	array(
		'label'    => esc_html__( 'Copyright Text', 'handmade-craft' ),
		'section'  => 'handmade_craft_footer_options',
		'settings' => 'handmade_craft_footer_copyright_text',
		'type'     => 'textarea',
	)
);

//Copyright Alignment
$wp_customize->add_setting(
	'handmade_craft_footer_bottom_align',
	array(
		'default' 			=> 'center',
		'sanitize_callback' => 'sanitize_text_field'
	)
);

$wp_customize->add_control(
	'handmade_craft_footer_bottom_align',
	array(
		'label' => __('Copyright Alignment ','handmade-craft'),
		'section' => 'handmade_craft_footer_options',
		'type'			=> 'select',
		'choices' => 
		array(
			'left' => __('Left','handmade-craft'),
			'right' => __('Right','handmade-craft'),
			'center' => __('Center','handmade-craft'),
		),
	)
);

//Copyright Font Size
$wp_customize->add_setting( 
	'handmade_craft_copyright_font_size', 
	array(
		'default'           => 16,
		'sanitize_callback' => 'absint',
	)
);

$wp_customize->add_control( 'handmade_craft_copyright_font_size', 
	array(
		'type'        => 'number',
		'section'     => 'handmade_craft_footer_options',
		'label'       => __( 'copyright Font Size ', 'handmade-craft' ),
		'input_attrs' => 
		array(
			'min'  => 10,
			'max'  => 100,
			'step' => 1,
		),
	)
);

// Add Separator Custom Control
$wp_customize->add_setting( 'handmade_craft_scroll_separators', array(
	'sanitize_callback' => 'sanitize_text_field',
) );

$wp_customize->add_control( new Handmade_Craft_Separator_Custom_Control( $wp_customize, 'handmade_craft_scroll_separators', array(
	'label' => __( 'Scroll Top Settings', 'handmade-craft' ),
	'section' => 'handmade_craft_footer_options',
	'settings' => 'handmade_craft_scroll_separators',
)));

// Footer Options - Scroll Top.
$wp_customize->add_setting(
	'handmade_craft_scroll_top',
	array(
		'sanitize_callback' => 'handmade_craft_sanitize_switch',
		'default'           => true,
	)
);

$wp_customize->add_control(
	new Handmade_Craft_Toggle_Switch_Custom_Control(
		$wp_customize,
		'handmade_craft_scroll_top',
		array(
			'label'   => esc_html__( 'Enable Scroll Top Button', 'handmade-craft' ),
			'section' => 'handmade_craft_footer_options',
		)
	)
);
// icon // 
$wp_customize->add_setting(
	'handmade_craft_scroll_btn_icon',
	array(
        'default' => 'fas fa-chevron-up',
		'sanitize_callback' => 'sanitize_text_field',
		'capability' => 'edit_theme_options',
		
	)
);	

$wp_customize->add_control(new Handmade_Craft_Change_Icon_Control($wp_customize, 
	'handmade_craft_scroll_btn_icon',
	array(
	    'label'   		=> __('Scroll Top Icon','handmade-craft'),
	    'section' 		=> 'handmade_craft_footer_options',
		'iconset' => 'fa',
	))  
);


$wp_customize->add_setting( 'handmade_craft_scroll_top_position', array(
    'default'           => 'bottom-right',
    'sanitize_callback' => 'handmade_craft_sanitize_scroll_top_position',
) );

// Add control for Scroll Top Button Position
$wp_customize->add_control( 'handmade_craft_scroll_top_position', array(
    'label'    => __( 'Scroll Top Button Position', 'handmade-craft' ),
    'section'  => 'handmade_craft_footer_options',
    'settings' => 'handmade_craft_scroll_top_position',
    'type'     => 'select',
    'choices'  => array(
        'bottom-right' => __( 'Bottom Right', 'handmade-craft' ),
        'bottom-left'  => __( 'Bottom Left', 'handmade-craft' ),
        'bottom-center'=> __( 'Bottom Center', 'handmade-craft' ),
    ),
) );

$wp_customize->add_setting( 'handmade_craft_scroll_top_shape', array(
    'default'           => 'box',
    'sanitize_callback' => 'sanitize_text_field',
) );

$wp_customize->add_control( 'handmade_craft_scroll_top_shape', array(
    'label'    => __( 'Scroll to Top Button Shape', 'handmade-craft' ),
    'section'  => 'handmade_craft_footer_options',
    'settings' => 'handmade_craft_scroll_top_shape',
    'type'     => 'radio',
    'choices'  => array(
        'box'        => __( 'Box', 'handmade-craft' ),
        'curved-box' => __( 'Curved Box', 'handmade-craft' ),
        'circle'     => __( 'Circle', 'handmade-craft' ),
    ),
) );