<?php
/**
 * Social Media Sections
 *
 * @package Chic Lifestyle
 */
add_action( 'customize_register', 'chic_lifestyle_social_media_sections' );

function chic_lifestyle_social_media_sections( $wp_customize ) {

	$wp_customize->add_section( 'chic_lifestyle_social_media_sections', array(
	    'title'          => esc_html__( 'Social Media', 'chic-lifestyle' ),
	    'description'    => esc_html__( 'Social Media', 'chic-lifestyle' ),
	    'priority'       => 4,
	    'panel'			 => 'chic_lifestyle_header_panel',
	) );

	$wp_customize->add_setting( new Chic_Lifestyle_Repeater_Setting(
		$wp_customize, 'chic_lifestyle_social_media', array(
      'default'     => '',
			'sanitize_callback' => array( 'Chic_Lifestyle_Repeater_Setting', 'sanitize_repeater_setting' ),
    )
	) );
    
    $wp_customize->add_control( new Chic_Lifestyle_Control_Repeater(
    	$wp_customize, 'chic_lifestyle_social_media',array(
				'section' => 'chic_lifestyle_social_media_sections',
				'settings'    => 'chic_lifestyle_social_media',
				'label'	  => esc_html__( 'Social Links', 'chic-lifestyle' ),
				'fields' => array(
					'social_media_title' => array(
						'type'        => 'text',
						'label'       => esc_html__( 'Social Media Title', 'chic-lifestyle' ),
						'description' => esc_html__( 'This will be the label.', 'chic-lifestyle' ),
						'default'     => '',
					),
					'social_media_class' => array(
						'type'        => 'text',
						'label'       => esc_html__( 'Social Media Class', 'chic-lifestyle' ),
						'default'     => '',
					),
					'social_media_link' => array(
						'type'      => 'url',
						'label'     => esc_html__( 'Social Media Links', 'chic-lifestyle' ),
				        'default'   => '',
					),			
				),
		    'row_label' => array(
				'type'  => 'field',
				'value' => esc_html__('Social Media', 'chic-lifestyle' ),
				'field' => 'social_media_title',
		    ),                        
	  )
  ) );

  $wp_customize->selective_refresh->add_partial('chic_lifestyle_social_media', array(
    'selector' => '#chic_lifestyle_social_media_sections'
  ));
	
}