<?php
/**
 * Social Settings
 *
 * @package Feminine_Lifestyle_Blog
 */

function feminine_lifestyle_blog_customize_register_general_social( $wp_customize ) {
    
    /** Social Media Settings */
    $wp_customize->add_section(
        'social_media_settings',
        array(
            'title'    => __( 'Social Media', 'feminine-lifestyle-blog' ),
            'priority' => 30,
            'panel'    => 'general_settings',
        )
    );
    
    /** Enable Social Links */
    $wp_customize->add_setting( 
        'ed_social_links', 
        array(
            'default'           => false,
            'sanitize_callback' => 'feminine_lifestyle_blog_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
		new Feminine_Lifestyle_Blog_Toggle_Control( 
			$wp_customize,
			'ed_social_links',
			array(
				'section'     => 'social_media_settings',
				'label'	      => __( 'Enable Social Links', 'feminine-lifestyle-blog' ),
                'description' => __( 'Enable to show social links at header and footer.', 'feminine-lifestyle-blog' ),
			)
		)
	);
    
    $wp_customize->add_setting( 
        new Feminine_Lifestyle_Blog_Repeater_Setting( 
            $wp_customize, 
            'social_links', 
            array(
                'default' => array(
                    array(
                        'font' => 'fab fa-facebook-f',
                        'link' => 'https://www.facebook.com/',                        
                    ),
                    array(
                        'font' => 'fab fa-twitter',
                        'link' => 'https://twitter.com/',
                    ),
                    array(
                        'font' => 'fab fa-youtube',
                        'link' => 'https://www.youtube.com/',
                    ),
                    array(
                        'font' => 'fab fa-instagram',
                        'link' => 'https://www.instagram.com/',
                    ),
                    array(
                        'font' => 'fab fa-pinterest',
                        'link' => 'https://www.pinterest.com/',
                    )
                ),
                'sanitize_callback' => array( 'Feminine_Lifestyle_Blog_Repeater_Setting', 'sanitize_repeater_setting' ),
            ) 
        ) 
    );
    
    $wp_customize->add_control(
		new Feminine_Lifestyle_Blog_Control_Repeater(
			$wp_customize,
			'social_links',
			array(
				'section' => 'social_media_settings',				
				'label'	  => __( 'Social Links', 'feminine-lifestyle-blog' ),
				'fields'  => array(
                    'font' => array(
                        'type'        => 'font',
                        'label'       => __( 'Font Awesome Icon', 'feminine-lifestyle-blog' ),
                        'description' => __( 'Example: fab fa-facebook-f', 'feminine-lifestyle-blog' ),
                    ),
                    'link' => array(
                        'type'        => 'url',
                        'label'       => __( 'Link', 'feminine-lifestyle-blog' ),
                        'description' => __( 'Example: https://facebook.com', 'feminine-lifestyle-blog' ),
                    )
                ),
                'row_label' => array(
                    'type' => 'field',
                    'value' => __( 'links', 'feminine-lifestyle-blog' ),
                    'field' => 'link'
                )                        
			)
		)
	);
    /** Social Media Settings Ends */
    
}
add_action( 'customize_register', 'feminine_lifestyle_blog_customize_register_general_social' );