<?php 
    class Edumodo_Customizer_Footer_Social{
        private $panel_key;
        private $priority;
        private $text_domain = 'edumodo';
        public function __construct($panel_key, $priority){
            $this->panel_key = $panel_key;
            $this->priority = $priority;
            $this->footer_social_kirki_config();
        }
        public function footer_social_kirki_config(){
            
            #	start of blog region 
                Kirki::add_section( 'edumodo_section_footer_social', array(
                    'title'          => esc_html__( 'Social', $this->text_domain ),
                    'panel'          => $this->panel_key,
                    'priority'       => $this->priority,
                ) );
                    Kirki::add_field( 'edumodo_section_footer_social_enable', [
                        'type'        => 'radio-buttonset',
                        'settings'    => 'edumodo_section_footer_social_enable',
                        'label'       => esc_html__( 'Social Area', 'edumodo' ),
                        'section'     => 'edumodo_section_footer_social',
                        'default'     => 'on',
                        'priority'    => 10,
                        'choices'     => [
                            'on'   => esc_html__( 'Yes', 'edumodo' ),
                            'off' => esc_html__( 'No', 'edumodo' ),
                        ],
                    ] );
                    Kirki::add_field('edumodo_footer_social_fb_url', [
                        'type'     => 'link',
                        'settings' => 'edumodo_footer_social_fb_url',
                        'label'    => __('Facebook', $this->text_domain),
                        'section'  => 'edumodo_section_footer_social',
                        'default'  => '#',
                        'priority' => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_section_footer_social_enable',
                                'operator' => '==',
                                'value'    => 'on',
                            ]
                        ]
                    ]);
                    Kirki::add_field('edumodo_footer_social_tw_url', [
                        'type'     => 'link',
                        'settings' => 'edumodo_footer_social_tw_url',
                        'label'    => __('Twitter', $this->text_domain),
                        'section'  => 'edumodo_section_footer_social',
                        'default'  => '#',
                        'priority' => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_section_footer_social_enable',
                                'operator' => '==',
                                'value'    => 'on',
                            ]
                        ]
                    ]);
                    Kirki::add_field('edumodo_footer_social_ins_url', [
                        'type'     => 'link',
                        'settings' => 'edumodo_footer_social_ins_url',
                        'label'    => __('Instagram', $this->text_domain),
                        'section'  => 'edumodo_section_footer_social',
                        'default'  => '#',
                        'priority' => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_section_footer_social_enable',
                                'operator' => '==',
                                'value'    => 'on',
                            ]
                        ]
                    ]);
                    Kirki::add_field('edumodo_footer_social_lk_url', [
                        'type'     => 'link',
                        'settings' => 'edumodo_footer_social_lk_url',
                        'label'    => __('Linkedin', $this->text_domain),
                        'section'  => 'edumodo_section_footer_social',
                        'default'  => '#',
                        'priority' => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_section_footer_social_enable',
                                'operator' => '==',
                                'value'    => 'on',
                            ]
                        ]
                    ]);
                    Kirki::add_field('edumodo_footer_social_whts_url', [
                        'type'     => 'link',
                        'settings' => 'edumodo_footer_social_whts_url',
                        'label'    => __('Whatsapp', $this->text_domain),
                        'section'  => 'edumodo_section_footer_social',
                        'default'  => '#',
                        'priority' => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_section_footer_social_enable',
                                'operator' => '==',
                                'value'    => 'on',
                            ]
                        ]
                    ]);
                    Kirki::add_field('edumodo_footer_social_yt_url', [
                        'type'     => 'link',
                        'settings' => 'edumodo_footer_social_yt_url',
                        'label'    => __('Youtube', $this->text_domain),
                        'section'  => 'edumodo_section_footer_social',
                        'default'  => '#',
                        'priority' => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_section_footer_social_enable',
                                'operator' => '==',
                                'value'    => 'on',
                            ]
                        ]
                    ]);
                    Kirki::add_field('edumodo_footer_social_sk_url', [
                        'type'     => 'link',
                        'settings' => 'edumodo_footer_social_sk_url',
                        'label'    => __('Skype', $this->text_domain),
                        'section'  => 'edumodo_section_footer_social',
                        'default'  => '#',
                        'priority' => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_section_footer_social_enable',
                                'operator' => '==',
                                'value'    => 'on',
                            ]
                        ]
                    ]);
                    Kirki::add_field('edumodo_footer_social_snap_url', [
                        'type'     => 'link',
                        'settings' => 'edumodo_footer_social_snap_url',
                        'label'    => __('Snapchat', $this->text_domain),
                        'section'  => 'edumodo_section_footer_social',
                        'default'  => '#',
                        'priority' => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_section_footer_social_enable',
                                'operator' => '==',
                                'value'    => 'on',
                            ]
                        ]
                    ]);
                    /**
                     * check if child theme is not active
                     * then render below block
                     */
                    if( get_template_directory() === get_stylesheet_directory() ):
                        Kirki::add_field( 'edumodo_section_footer_social_section_bg_color', [
                            'type'        => 'color',
                            'settings'    => 'edumodo_section_footer_social_section_bg_color',
                            'label'       => esc_html__( 'Section', 'edumodo' ),
                            'section'     => 'edumodo_section_footer_social',
                            'active_callback' => [
                                [
                                    'setting'  => 'edumodo_section_footer_social_enable',
                                    'operator' => '==',
                                    'value'    => 'on',
                                ]
                            ],
                            'transport'   => 'auto',
                            'priority'    => 10,
                            'output'      => [
                                [
                                    'element'  => '.footer-middle, .footer-middle .footer-middle-row',
                                ]
                            ],
                            'active_callback' => [
                                [
                                    'setting'  => 'edumodo_section_footer_layout_select',
                                    'operator' => '==',
                                    'value'    => 'layout-2',
                                ]
                            ],
                        ] );
                    endif;
            
                    Kirki::add_field( 'edumodo_section_footer_social_text_color', [
                        'type'        => 'color',
                        'settings'    => 'edumodo_section_footer_social_text_color',
                        'label'       => __( 'Icon', 'edumodo' ),
                        'section'     => 'edumodo_section_footer_social',
                        'transport'   => 'auto',
                        'priority'    => 10,
                        'choices'     => [
                            'alpha' => true,
                        ],
                        'output'      => [
                            [
                                'element'  => '.edumodo-footer-social a, .copyright .social-icon a, .footer-child .social-icon a i',
                                'property' => 'color',
                            ]
                        ],
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_section_footer_social_enable',
                                'operator' => '==',
                                'value'    => 'on',
                            ]
                        ],
                    ] );
            
                    Kirki::add_field( 'edumodo_section_footer_social_hover_color', [
                        'type'        => 'color',
                        'settings'    => 'edumodo_section_footer_social_hover_color',
                        'label'       => __( 'Hover', 'edumodo' ),
                        'section'     => 'edumodo_section_footer_social',
                        'transport'   => 'auto',
                        'priority'    => 10,
                        'choices'     => [
                            'alpha' => true,
                        ],
                        'output'      => [
                            [
                                'element'  => '.edumodo-footer-social a:hover, .copyright .social-icon a:hover, .footer-child .social-icon a:hover i',
                                'property' => 'color',
                            ]
                        ],
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_section_footer_social_enable',
                                'operator' => '==',
                                'value'    => 'on',
                            ]
                        ],
                    ] );
            
                    Kirki::add_field( 'edumodo_section_footer_social_bg_color', [
                        'type'        => 'color',
                        'settings'    => 'edumodo_section_footer_social_bg_color',
                        'label'       => __( 'Background', 'edumodo' ),
                        'section'     => 'edumodo_section_footer_social',
                        'transport'   => 'auto',
                        'priority'    => 10,
                        'choices'     => [
                            'alpha' => true,
                        ],
                        'output'      => [
                            [
                                'element'  => '.edumodo-footer-social a, .footer-child .social-icon a',
                                'property' => 'background',
                            ]
                        ],
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_section_footer_social_enable',
                                'operator' => '==',
                                'value'    => 'on',
                            ],
                            [
                                'setting'  => 'edumodo_section_footer_layout_select',
                                'operator' => '==',
                                'value'    => 'layout-2',
                            ]
                        ],
                    ] );
                    Kirki::add_field( 'edumodo_section_footer_social_bg_hover_color', [
                        'type'        => 'color',
                        'settings'    => 'edumodo_section_footer_social_bg_hover_color',
                        'label'       => __( 'Background Hover', 'edumodo' ),
                        'section'     => 'edumodo_section_footer_social',
                        'transport'   => 'auto',
                        'priority'    => 10,
                        'choices'     => [
                            'alpha' => true,
                        ],
                        'output'      => [
                            [
                                'element'  => '.edumodo-footer-social a:hover, .footer-child .social-icon a:hover',
                                'property' => 'background',
                            ]
                        ],
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_section_footer_social_enable',
                                'operator' => '==',
                                'value'    => 'on',
                            ],
                            [
                                'setting'  => 'edumodo_section_footer_layout_select',
                                'operator' => '==',
                                'value'    => 'layout-2',
                            ]
                        ],
                    ] );
            #	end of blog region 


        }
    }
?>