<?php

$wp_customize->add_section('constructionarc_social_section', array(
    'title' => esc_html__('Social Media', 'construction-arc'),
    'panel' => 'constructionarc_header_settings',
    'priority' => 201,
));
$wp_customize->add_setting('constructionarc_social_section_nav', array(
    'transport' => 'postMessage',
    'sanitize_callback' => 'wp_kses_post',
    
));

$wp_customize->add_control(new constructionarc_Custom_Control_Tab($wp_customize, 'constructionarc_social_section_nav', array(
    'type' => 'tab',
    'section' => 'constructionarc_social_section',
    'buttons' => array(
        array(
            'name' => esc_html__('Content', 'construction-arc'),
            'fields' => array(
                'constructionarc_topheader_social',
            ),
            'active' => true,
        ),
        array(
            'name' => esc_html__('Style', 'construction-arc'),
            'fields' => array(
               'constructionarc_social_icon_color',
               'constructionarc_social_icon_bg_color',
               'constructionarc_social_icon_hover_color',
               'constructionarc_social_icon_hover_bg_color'
            ),
        ),
    ),
)));

$wp_customize->add_setting('constructionarc_topheader_social', array(
    'transport' => 'postMessage',
    'sanitize_callback' => 'constructionarc_themes_sanitize_repeater',
    'default' => json_encode(array(
        array(
            'icon' => 'fab fa-facebook',
            'link' => '#',
        ),
        array(
            'icon' => 'fa-brands fa-x-twitter',
            'link' => '#',
        ),
        array(
            'icon' => 'fab fa-linkedin',
            'link' => '#',
        ),
        array(
            'icon' => 'fab fa-pinterest',
            'link' => '#',
        ),
        array(
            'icon' => 'fab fa-instagram',
            'link' => '#',
        ),
        array(
            'icon' => 'fab fa-youtube',
            'link' => '#',
        )
    ))
));
$wp_customize->add_control(new constructionarc_Themes_Repeater_Control($wp_customize, 'constructionarc_topheader_social', array(
        'label' => esc_html__('Social Links', 'construction-arc'),
        'section' => 'constructionarc_social_section',
        'box_label' => esc_html__('Social Link', 'construction-arc'),
        'add_label' => esc_html__('Add New', 'construction-arc'),
        'limit' => 6,
    ), 
    array(
        'icon' => array(
            'type' => 'social-icon',
            'label' => esc_html__('Select Icon', 'construction-arc'),
            'default' => 'icofont-facebook'
        ),
        'link' => array(
            'type' => 'url',
            'label' => esc_html__('Link', 'construction-arc'),
            'default' => ''
        ),
    )
));

$wp_customize->selective_refresh->add_partial( 'constructionarc_topheader_social', array (
    'settings' => array( 'constructionarc_topheader_social' ),
    'selector' => '.top-bar-menu .constructionarc-socialicon',
    'container_inclusive' => true,
    'render_callback' => function () {
        return constructionarc_themes_topheader_social();
    }
));

$wp_customize->add_setting('constructionarc_social_icon_color', array(
    'sanitize_callback' => 'constructionarc_themes_sanitize_color_alpha',
    'default' => '',
    'transport' => 'postMessage'
));
$wp_customize->add_control(new constructionarc_Alpha_Color_Control($wp_customize, 'constructionarc_social_icon_color', array(
    'section' => 'constructionarc_social_section',
    'label' => esc_html__('Color', 'construction-arc')
)));

$wp_customize->add_setting('constructionarc_social_icon_bg_color', array(
    'sanitize_callback' => 'constructionarc_themes_sanitize_color_alpha',
    'default' => '',
    'transport' => 'postMessage'
));
$wp_customize->add_control(new constructionarc_Alpha_Color_Control($wp_customize, 'constructionarc_social_icon_bg_color', array(
    'section' => 'constructionarc_social_section',
    'label' => esc_html__('Background Color', 'construction-arc')
)));

$wp_customize->add_setting('constructionarc_social_icon_hover_color', array(
    'sanitize_callback' => 'constructionarc_themes_sanitize_color_alpha',
    'default' => '',
    'transport' => 'postMessage'
));
$wp_customize->add_control(new constructionarc_Alpha_Color_Control($wp_customize, 'constructionarc_social_icon_hover_color', array(
    'section' => 'constructionarc_social_section',
    'label' => esc_html__('Hover Color', 'construction-arc')
)));

$wp_customize->add_setting('constructionarc_social_icon_hover_bg_color', array(
    'sanitize_callback' => 'constructionarc_themes_sanitize_color_alpha',
    'default' => '',
    'transport' => 'postMessage'
));
$wp_customize->add_control(new constructionarc_Alpha_Color_Control($wp_customize, 'constructionarc_social_icon_hover_bg_color', array(
    'section' => 'constructionarc_social_section',
    'label' => esc_html__('Hover Background Color', 'construction-arc')
)));