<?php
/**
*Footer customizer options
*
* @package gridchamp
*
*/
if(gridchamp_set_to_premium()):
	if (! function_exists('gridchamp_footer_options_register')) {
		function gridchamp_footer_options_register( $wp_customize ) {
			$wp_customize->add_section('gridchamp_footer_setting', 
			 	array(
			        'title' => esc_html__('Footer', 'gridchamp'),
			        'panel' =>'gridchamp_theme_option',
			        'priority' => 12
		    	)
			 );

			$wp_customize->add_setting( 
		        'gridchamp_footer_layout', 
		        array(
		            'default'           => 'footer-layout-one',
		            'sanitize_callback' => 'gridchamp_sanitize_choices'
		        ) 
		    );
		    
		    $wp_customize->add_control(
				new WP_Customize_Control(
					$wp_customize,
					'gridchamp_footer_layout',
					array(
						'section'	  => 'gridchamp_footer_setting',
						'label'		  => esc_html__( 'Footer Settings', 'gridchamp' ),
						'description' => esc_html__( 'Choose Layout', 'gridchamp' ),
						'type'           => 'select',
						'choices'	  => array(
							'footer-layout-one'    => esc_html__('Layout 1','gridchamp'),
							'footer-layout-two'  => esc_html__('Layout 2','gridchamp'),
						),
						'priority' => 2,
					)
				)
			);
			$wp_customize->add_setting('footer_bg_image', array(
		        'transport'         => 'refresh',
		        'sanitize_callback'     =>  'gridchamp_sanitize_file',
		    ));

		    $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'footer_bg_image', array(
		    	'label' => '',
		        'description'             => esc_html__('Background Image', 'gridchamp'),
		        'section'           => 'gridchamp_footer_setting',
		        'settings'          => 'footer_bg_image',
		        'priority' 			=> 3,
		
		    )));
			$wp_customize->add_setting( 'gridchamp_footer_bg_color', 
				array(
			        'default'        => '#232323',
			        'sanitize_callback' => 'gridchamp_sanitize_hex_color',
		    	) 
			);

			$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 
				'gridchamp_footer_bg_color', 
				array(
					'label' => '',
			        'description'   => esc_html__( 'Background Color', 'gridchamp' ),
			        'section' => 'gridchamp_footer_setting',
			        'settings'   => 'gridchamp_footer_bg_color',
			        'priority' => 4
			    ) ) 
			);
			$wp_customize->add_setting( 'footer_bg_opacity', 
			array(
				'capability' => 'edit_theme_options',
				'sanitize_callback' => 'gridchamp_sanitize_number_range',
				'default' => '1',
				) 
			);

			$wp_customize->add_control( 'footer_bg_opacity', 
				array(
					'section' => 'gridchamp_footer_setting',
					'settings' => 'footer_bg_opacity',
					'label' => esc_html__( 'Opacity of Background','gridchamp' ),
					'description' => '',
					'type'              => 'range',
				    'input_attrs'       => array(
				        'min'           => 0,
				        'max'           => 1.000,
				        'step'          => 0.001,
				    ),
				    'priority' => 4
				) 
			);
			$wp_customize->selective_refresh->add_partial( 'gridchamp_footer_bg_color', array(
	            'selector' => 'footer#colophon',
	        ) );
			$wp_customize->add_setting( 'gridchamp_footer_text_color', 
				array(
			        'default'        => '#ffffff',
			        'sanitize_callback' => 'gridchamp_sanitize_hex_color',
		    	) 
			);

			$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 
				'gridchamp_footer_text_color', 
				array(
					'label' => '',
			        'description'   => esc_html__( 'Text Color', 'gridchamp' ),
			        'section' => 'gridchamp_footer_setting',
			        'settings'   => 'gridchamp_footer_text_color',
			        'priority' => 4
			    ) ) 
			);
			$wp_customize->add_setting( 'gridchamp_footer_link_color', 
				array(
			        'default'        => '#04a06e',
			        'sanitize_callback' => 'gridchamp_sanitize_hex_color',
		    	) 
			);

			$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 
				'gridchamp_footer_link_color', 
				array(
					'label' => '',
			        'description'   => esc_html__( 'Link Color', 'gridchamp' ),
			        'section' => 'gridchamp_footer_setting',
			        'settings'   => 'gridchamp_footer_link_color',
			        'priority' => 4
			    ) ) 
			);
			$wp_customize->add_setting( 'gridchamp_footer_link_hover_color', 
				array(
			        'default'        => '#ff9800',
			        'sanitize_callback' => 'gridchamp_sanitize_hex_color',
		    	) 
			);

			$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 
				'gridchamp_footer_link_hover_color', 
				array(
					'label' => '',
			        'description'   => esc_html__( 'Link Hover Color', 'gridchamp' ),
			        'section' => 'gridchamp_footer_setting',
			        'settings'   => 'gridchamp_footer_link_hover_color',
			        'priority' => 4
			    ) ) 
			);
			$wp_customize->add_setting( 'gridchamp_footer_bottom_color', 
				array(
			        'default'        => '#000000',
			        'sanitize_callback' => 'gridchamp_sanitize_hex_color',
		    	) 
			);

			$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 
				'gridchamp_footer_bottom_color', 
				array(
			        'label'   => esc_html__( 'Copyright Settings', 'gridchamp' ),
			        'description' => esc_html__('Background Color','gridchamp'),
			        'section' => 'gridchamp_footer_setting',
			        'settings'   => 'gridchamp_footer_bottom_color',
			        'priority' => 4
			    ) ) 
			);
			$wp_customize->add_setting( 'copyright_bg_opacity', 
			array(
				'capability' => 'edit_theme_options',
				'sanitize_callback' => 'gridchamp_sanitize_number_range',
				'default' => '1',
				) 
			);

			$wp_customize->add_control( 'copyright_bg_opacity', 
				array(
					'section' => 'gridchamp_footer_setting',
					'settings' => 'copyright_bg_opacity',
					'label' => esc_html__( 'Opacity of Background','gridchamp' ),
					'description' => '',
					'type'              => 'range',
				    'input_attrs'       => array(
				        'min'           => 0,
				        'max'           => 1.000,
				        'step'          => 0.001,
				    ),
				    'priority' => 4
				) 
			);
			$wp_customize->add_setting( 'gridchamp_copyright_text_color', 
				array(
			        'default'        => '#ffffff',
			        'sanitize_callback' => 'gridchamp_sanitize_hex_color',
		    	) 
			);

			$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 
				'gridchamp_copyright_text_color', 
				array(
					'label' => '',
			        'description'   => esc_html__( 'Copyright Text Color', 'gridchamp' ),
			        'section' => 'gridchamp_footer_setting',
			        'settings'   => 'gridchamp_copyright_text_color',
			        'priority' => 4
			    ) ) 
			);
			
			$wp_customize->add_setting( 'footer_copiright_text', 
			 	array(
					'capability' => 'edit_theme_options',
					'default' => '',
					'sanitize_callback' => 'wp_kses_post',
				) 
			);

			$wp_customize->add_control( 'footer_copiright_text', 
				array(
					'type' => 'textarea',
					'section' => 'gridchamp_footer_setting',
					'label' => '',
					'description' => esc_html__( 'Copyright Text','gridchamp' ),
				)
			);
			$wp_customize->add_setting( 
	        'copyright_text_alignment', 
	        array(
	            'default'           => 'copyright-text-align-left',
	            'sanitize_callback' => 'gridchamp_sanitize_choices'
	        ) 
	    );
	    
	    $wp_customize->add_control(
			new WP_Customize_Control(
				$wp_customize,
				'copyright_text_alignment',
				array(
					'section'	  => 'gridchamp_footer_setting',
					'description'		  => esc_html__( 'Text Alignment', 'gridchamp' ),
					'label' => '',
					'type'        => 'select',
					'choices'	  => array(
						'copyright-text-align-left'  => esc_html__('Left','gridchamp'),
						'copyright-text-align-center'  => esc_html__('Center','gridchamp'),
					),
					
				)
			)
		);
			$wp_customize->selective_refresh->add_partial( 'footer_copiright_text', array(
	            'selector' => '.site-info',
	        ) );

	        $wp_customize->add_setting( 'gridchamp_copyright_section_padding_top', 
			array(
				'capability' => 'edit_theme_options',
				'sanitize_callback' => 'gridchamp_sanitize_number_absint',
				'default' => 15,
			) 
		);

		$wp_customize->add_control( 'gridchamp_copyright_section_padding_top', 
			array(
				'type' => 'number',
				'section' => 'gridchamp_footer_setting',
				'settings' => 'gridchamp_copyright_section_padding_top',
				'label' => '',
				'description' => esc_html__( 'Section Top Space','gridchamp' ),
				'input_attrs' => array(
			        'min'   => 0,
			        'max'   => 200,
			        'step'  => 1,
			    ),
			    'priority' => 50,
			) 
		);
		$wp_customize->add_setting( 'gridchamp_copyright_section_padding_bottom', 
			array(
				'capability' => 'edit_theme_options',
				'sanitize_callback' => 'gridchamp_sanitize_number_absint',
				'default' => 15,
			) 
		);

		$wp_customize->add_control( 'gridchamp_copyright_section_padding_bottom', 
			array(
				'type' => 'number',
				'section' => 'gridchamp_footer_setting',
				'settings' => 'gridchamp_copyright_section_padding_bottom',
				'description' => esc_html__( 'Section Bottom Space','gridchamp' ),
				'label' => '',
				'input_attrs' => array(
			        'min'   => 0,
			        'max'   => 200,
			        'step'  => 1,
			    ),
			    'priority' => 50,
			) 
		);
		}

	}
	add_action( 'customize_register', 'gridchamp_footer_options_register' );
endif;
