<?php
/**
 * Sidebar Position
 *
 * @package handmade_craft
 */

$wp_customize->add_section(
	'handmade_craft_sidebar_position',
	array(
		'title' => esc_html__( 'Sidebar Position', 'handmade-craft' ),
		'panel' => 'handmade_craft_theme_options',
	)
);

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

$wp_customize->add_control( new Handmade_Craft_Separator_Custom_Control( $wp_customize, 'handmade_craft_global_sidebar_separator', array(
	'label' => __( 'Global Sidebar Position', 'handmade-craft' ),
	'section' => 'handmade_craft_sidebar_position',
	'settings' => 'handmade_craft_global_sidebar_separator',
)));

// Sidebar Position - Global Sidebar Position.
$wp_customize->add_setting(
	'handmade_craft_sidebar_position',
	array(
		'sanitize_callback' => 'handmade_craft_sanitize_select',
		'default'           => 'right-sidebar',
	)
);

$wp_customize->add_control(
	'handmade_craft_sidebar_position',
	array(
		'label'   => esc_html__( 'Select Sidebar Position', 'handmade-craft' ),
		'section' => 'handmade_craft_sidebar_position',
		'type'    => 'select',
		'choices' => array(
			'right-sidebar' => esc_html__( 'Right Sidebar', 'handmade-craft' ),
			'left-sidebar'  => esc_html__( 'Left Sidebar', 'handmade-craft' ),
			'no-sidebar'    => esc_html__( 'No Sidebar', 'handmade-craft' ),
		),
	)
);

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

$wp_customize->add_control( new Handmade_Craft_Separator_Custom_Control( $wp_customize, 'handmade_craft_page_sidebar_separator', array(
	'label' => __( 'Page Sidebar Position', 'handmade-craft' ),
	'section' => 'handmade_craft_sidebar_position',
	'settings' => 'handmade_craft_page_sidebar_separator',
)));

// Sidebar Position - Page Sidebar Position.
$wp_customize->add_setting(
	'handmade_craft_page_sidebar_position',
	array(
		'sanitize_callback' => 'handmade_craft_sanitize_select',
		'default'           => 'right-sidebar',
	)
);

$wp_customize->add_control(
	'handmade_craft_page_sidebar_position',
	array(
		'label'   => esc_html__( 'Select Sidebar Position', 'handmade-craft' ),
		'section' => 'handmade_craft_sidebar_position',
		'type'    => 'select',
		'choices' => array(
			'right-sidebar' => esc_html__( 'Right Sidebar', 'handmade-craft' ),
			'left-sidebar'  => esc_html__( 'Left Sidebar', 'handmade-craft' ),
			'no-sidebar'    => esc_html__( 'No Sidebar', 'handmade-craft' ),
		),
	)
);

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

$wp_customize->add_control( new Handmade_Craft_Separator_Custom_Control( $wp_customize, 'handmade_craft_post_sidebar_separator', array(
	'label' => __( 'Post Sidebar Position', 'handmade-craft' ),
	'section' => 'handmade_craft_sidebar_position',
	'settings' => 'handmade_craft_post_sidebar_separator',
)));

// Sidebar Position - Post Sidebar Position.
$wp_customize->add_setting(
	'handmade_craft_post_sidebar_position',
	array(
		'sanitize_callback' => 'handmade_craft_sanitize_select',
		'default'           => 'right-sidebar',
	)
);

$wp_customize->add_control(
	'handmade_craft_post_sidebar_position',
	array(
		'label'   => esc_html__( 'Select Sidebar Position', 'handmade-craft' ),
		'section' => 'handmade_craft_sidebar_position',
		'type'    => 'select',
		'choices' => array(
			'right-sidebar' => esc_html__( 'Right Sidebar', 'handmade-craft' ),
			'left-sidebar'  => esc_html__( 'Left Sidebar', 'handmade-craft' ),
			'no-sidebar'    => esc_html__( 'No Sidebar', 'handmade-craft' ),
		),
	)
);

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

$wp_customize->add_control( new Handmade_Craft_Separator_Custom_Control( $wp_customize, 'handmade_craft_sidebar_width_separator', array(
	'label' => __( 'Sidebar Width Setting', 'handmade-craft' ),
	'section' => 'handmade_craft_sidebar_position',
	'settings' => 'handmade_craft_sidebar_width_separator',
)));


$wp_customize->add_setting( 'handmade_craft_sidebar_width', array(
	'default'           => '30',
	'sanitize_callback' => 'handmade_craft_sanitize_range_value',
) );

$wp_customize->add_control(new Handmade_Craft_Customize_Range_Control($wp_customize, 'handmade_craft_sidebar_width', array(
	'section'     => 'handmade_craft_sidebar_position',
	'label'       => __( 'Adjust Sidebar Width', 'handmade-craft' ),
	'description' => __( 'Adjust the width of the sidebar.', 'handmade-craft' ),
	'input_attrs' => array(
		'min'  => 10,
		'max'  => 50,
		'step' => 1,
	),
)));

$wp_customize->add_setting( 'handmade_craft_sidebar_widget_font_size', array(
    'default'           => 24,
    'sanitize_callback' => 'absint',
) );

// Add control for site title size
$wp_customize->add_control( 'handmade_craft_sidebar_widget_font_size', array(
    'type'        => 'number',
    'section'     => 'handmade_craft_sidebar_position',
    'label'       => __( 'Sidebar Widgets Heading Font Size ', 'handmade-craft' ),
    'input_attrs' => array(
        'min'  => 10,
        'max'  => 100,
        'step' => 1,
    ),
));