<?php
$wp_customize->add_section('constructionarc_titlebar_section', array(
    'title' => esc_html__('Breadcrumb Setting', 'construction-arc'),
    'priority' => 60,
    'description' => esc_html__('This setting will apply in all posts, pages, archive and search page', 'construction-arc'),
    'hiding_control' => 'constructionarc_breadcrumb_option'
));

$wp_customize->add_setting('constructionarc_breadcrumb_option', array(
    'sanitize_callback' => 'constructionarc_themes_sanitize_switch',
    'transport' => 'postMessage',
    'default' => 'enable'
));
$wp_customize->add_control(new constructionarc_Switch_Control($wp_customize, 'constructionarc_breadcrumb_option', array(
    'section' => 'constructionarc_titlebar_section',
    'label' => esc_html__('Breadcrumb', 'construction-arc'),
    'switch_label' => array(
        'enable' => esc_html__('Enable', 'construction-arc'),
        'disable' => esc_html__('Disable', 'construction-arc')
    ),
    'class' => 'switch-section',
    'priority' => -1,
)));

$wp_customize->add_setting('constructionarc_enable_breadcrumbs_nav', array(
    'transport' => 'postMessage',
    'sanitize_callback' => 'wp_kses_post',
));
$wp_customize->add_control(new constructionarc_Custom_Control_Tab($wp_customize, 'constructionarc_enable_breadcrumbs_nav', array(
    'type' => 'tab',
    'section' => 'constructionarc_titlebar_section',
    'buttons' => array(
        array(
            'name' => esc_html__('Content', 'construction-arc'),
            'fields' => array(
                'constructionarc_show_title',
                'constructionarc_breadcrumb',
                'constructionarc_titlebar_title_align'
            ),
            'active' => true,
        ),
        array(
            'name' => esc_html__('Style', 'construction-arc'),
            'fields' => array(
                'constructionarc_titlebar_cs_heading',
                'constructionarc_titlebar_title_color',
                'constructionarc_titlebar_text_color',
                'constructionarc_titlebar_link_color',
                'constructionarc_titlebar_link_hover_color',
            ),
        ),
        array(
            'name' => esc_html__('Advanced', 'construction-arc'),
            'fields' => array(
                'constructionarc_titlebar_bg_type',
                'constructionarc_titlebar_bg_color',
                'constructionarc_titlebar_bg_image',
                'constructionarc_titlebar_overlay_color',
                'constructionarc_titlebar_padding',
                'constructionarc_titlebar_section_seperator',
                'constructionarc_titlebar_bottom_seperator',
                'constructionarc_titlebar_bs_color',
                'constructionarc_titlebar_bs_height_desktop',
                
            ),
        ),
        array(
            'name' => esc_html__('Hidden', 'construction-arc'),
            'class' => 'customizer-hidden',
            'fields' => array(
                'constructionarc_titlebar_super_title_color',
                'constructionarc_titlebar_radius',
                'constructionarc_titlebar_cs_seperator',
                'constructionarc_titlebar_seperator0',
                'constructionarc_titlebar_seperator1',
                'constructionarc_titlebar_top_seperator',
                'constructionarc_titlebar_ts_color',
                'constructionarc_titlebar_ts_height',
            ),
        ),
    ),
)));

$wp_customize->add_setting('constructionarc_show_title', array(
    'sanitize_callback' => 'constructionarc_themes_sanitize_checkbox',
    'transport' => 'postMessage',
    'default' => true
));
$wp_customize->add_control(new constructionarc_Checkbox_Control($wp_customize, 'constructionarc_show_title', array(
    'section' => 'constructionarc_titlebar_section',
    'label' => esc_html__('Page Title', 'construction-arc')
)));


$wp_customize->add_setting('constructionarc_breadcrumb', array(
    'sanitize_callback' => 'constructionarc_themes_sanitize_checkbox',
    'transport' => 'postMessage',
    'default' => true
));
$wp_customize->add_control(new constructionarc_Checkbox_Control($wp_customize, 'constructionarc_breadcrumb', array(
    'section' => 'constructionarc_titlebar_section',
    'label' => esc_html__('Menu', 'construction-arc'),
)));

$wp_customize->add_setting( 'constructionarc_titlebar_title_align', array(
    'default'           => 'text-left',
    'sanitize_callback' => 'constructionarc_themes_sanitize_select',
    'transport'         => 'postMessage',
));
$wp_customize->add_control( new constructionarc_Custom_Control_Buttonset( $wp_customize,'constructionarc_titlebar_title_align',
    array(
        'choices'  => array(
            'text-left' => esc_html__('Left', 'construction-arc'),
            'text-right' => esc_html__('Right', 'construction-arc'),
            'text-center' => esc_html__('Center', 'construction-arc'),
        ),
        'label'    => esc_html__( 'Alignment', 'construction-arc' ),
        'section'  => 'constructionarc_titlebar_section',
    ))
);


$wp_customize->add_setting("constructionarc_titlebar_section_seperator", array(
    'transport' => 'postMessage',
    'sanitize_callback' => 'sanitize_text_field',
    'default' => 'bottom',
));
$wp_customize->add_control("constructionarc_titlebar_section_seperator", array(
    'section' => "constructionarc_titlebar_section",
    'type' => 'select',
    'label' => esc_html__('Select Separator', 'construction-arc'),
    'choices' => array(
        'no' => esc_html__('Disable', 'construction-arc'),
        'bottom' => esc_html__('Bottom Separator', 'construction-arc'),
    ),
    'priority' => 95
));

$wp_customize->add_setting("constructionarc_titlebar_bottom_seperator", array(
    'sanitize_callback' => 'sanitize_text_field',
    'default' => 'curv-9',
    'transport' => 'postMessage'
));
$wp_customize->add_control("constructionarc_titlebar_bottom_seperator", array(
    'section' => "constructionarc_titlebar_section",
    'type' => 'select',
    'label' => esc_html__('Bottom Separator', 'construction-arc'),
    'choices' => constructionarc_themes_svg_seperator(),
    'priority' => 105
));

$wp_customize->add_setting("constructionarc_titlebar_bs_color", array(
    'default' => '#ffffff',
    'sanitize_callback' => 'constructionarc_themes_sanitize_color_alpha',
    'transport' => 'postMessage'
));
$wp_customize->add_control(new constructionarc_Alpha_Color_Control($wp_customize, "constructionarc_titlebar_bs_color", array(
    'section' => "constructionarc_titlebar_section",
    'label' => esc_html__('Bottom Separator Color', 'construction-arc'),
    'priority' => 110
)));

$wp_customize->add_setting("constructionarc_titlebar_bs_height_desktop", array(
    'sanitize_callback' => 'constructionarc_themes_sanitize_number_blank',
    'default' => 40,
    'transport' => 'postMessage'
));
$wp_customize->add_setting("constructionarc_titlebar_bs_height_tablet", array(
    'sanitize_callback' => 'constructionarc_themes_sanitize_number_blank',
    'default' => 30,
    'transport' => 'postMessage'
));
$wp_customize->add_setting("constructionarc_titlebar_bs_height_mobile", array(
    'sanitize_callback' => 'constructionarc_themes_sanitize_number_blank',
    'default' => 20,
    'transport' => 'postMessage'
));
$wp_customize->add_control(new constructionarc_Range_Slider_Control($wp_customize, "constructionarc_titlebar_bs_height_desktop", array(
    'section' => "constructionarc_titlebar_section",
    'transport' => 'postMessage',
    'label' => esc_html__('Bottom Separator Height', 'construction-arc'),
    'input_attrs' => array(
        'min' => 20,
        'max' => 400,
        'step' => 1,
    ),
    'settings' => array(
        'desktop' => "constructionarc_titlebar_bs_height_desktop",
        'tablet' => "constructionarc_titlebar_bs_height_tablet",
        'mobile' => "constructionarc_titlebar_bs_height_mobile",
    ),
    'priority' => 120
)));


$wp_customize->add_setting('constructionarc_pro_breadcrumb', array(
    'sanitize_callback' => 'constructionarc_sanitize_text'
));
$wp_customize->add_control(new constructionarc_Themes_Upgrade_Text($wp_customize, 'constructionarc_pro_breadcrumb', array(
    'section' => 'constructionarc_titlebar_section',
    'label' => esc_html__('For More Settings,', 'construction-arc'),
    'choices' => array(
        esc_html__('Text Alignment Option', 'construction-arc'),
        esc_html__('Change Title & Menu link Color', 'construction-arc'),
        esc_html__('4+ Different Background Option ( Color/ Video/ Gradient/ Image ) ', 'construction-arc'),
        esc_html__('More Than 35+ Separator Shape Illustrator with Color & Height Option', 'construction-arc'),
    ),
    'priority' => 250,
)));


$wp_customize->selective_refresh->add_partial( 'constructionarc_breadcrumbs_settings', array (
    'settings' => array( 
        'constructionarc_breadcrumb_option', 
        'constructionarc_titlebar_section_seperator', 
        'constructionarc_titlebar_bottom_seperator',
    ),
    'selector' => '.breadcrumb-section',
    'container_inclusive' => true,
    'render_callback' => function() {
        constructionarc_themes_breadcrumbs();
    }
));