<?php 
    class Edumodo_Customizer_Header_Top_Bar{
        private $panel_key;
        private $priority;
        private $text_domain = 'edumodo';
        public function __construct($panel_key, $priority){
            $this->panel_key = $panel_key;
            $this->priority = $priority;
            $this->header_top_bar_config();
        }
        public function edudmodo_get_wp_menus() {
            $menus 		= array( esc_html__( 'Select Your Menu', 'edumodo' ) );
            $get_menus 	= get_terms( array(
                'taxonomy'	=> 'nav_menu',
                'hide_empty' => false
            ) );
            foreach ( $get_menus as $menu) {
                $menus[$menu->term_id] = $menu->name;
            }
            return $menus;
        }
        public function header_top_bar_config(){

            #   start variation region 
                Kirki::add_section('edumodo_header_top_bar', array(
                    'title' => esc_attr__('Top Bar', $this->text_domain),
                    'panel' => $this->panel_key,
                    'priority' => $this->priority,
                ) );
            
                    Kirki::add_field( 'edumodo_header_enable_top_bar', [
                        'type'        => 'radio-buttonset',
                        'settings'    => 'edumodo_header_enable_top_bar',
                        'label'       => esc_html__( 'Enable', $this->text_domain ),
                        'section'     => 'edumodo_header_top_bar',
                        'default'     => 'no',
                        'choices'     => [
                            'yes'   => esc_html__( 'Yes', $this->text_domain ),
                            'no' => esc_html__( 'No', $this->text_domain ),
                        ],
                    ] );
                    /**
                     * Left side
                     */
                    Kirki::add_field( 'header_top_bar_seperator_1', [
                        'type'        => 'custom',
                        'settings'    => 'header_top_bar_seperator_1',
                        'label'       => esc_html__( '', 'edumodo' ),
                        'section'     => 'edumodo_header_top_bar',
                        'default'     => '<h3 style="border: solid 1px #b3b3b3; text-align: center; letter-spacing: 2px;padding:15px 10px; background:#cecece; text-transform:uppercase; margin:10px -20px 5px;">' . __( 'Left Side  &darr;', 'edumodo' ) . '</h3>',
                        'priority'    => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ] );
                    Kirki::add_field( 'edumodo_header_top_bar', [
                        'type'     => 'text',
                        'settings' => 'edumodo_top_bar_phone',
                        'label'    => __( 'Phone', 'edumodo' ),
                        'section'  => 'edumodo_header_top_bar',
                        'default'  => esc_html__('0123456789','edumodo'),
                        'priority' => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ] );
                    Kirki::add_field( 'edumodo_top_bar_email', [
                        'type'     => 'text',
                        'settings' => 'edumodo_top_bar_email',
                        'label'    => __( 'Email', 'edumodo' ),
                        'section'  => 'edumodo_header_top_bar',
                        'default'  => esc_html__('hello@admin.com','edumodo'),
                        'priority' => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_top_bar_left_side_options',
                                'operator' => '==',
                                'value'    => 'contacts',
                            ],
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ] );

                    /**
                     * Right side
                     */
                    Kirki::add_field( 'header_top_bar_seperator_2', [
                        'type'        => 'custom',
                        'settings'    => 'header_top_bar_seperator_2',
                        'label'       => esc_html__( '', 'edumodo' ),
                        'section'     => 'edumodo_header_top_bar',
                        'default'     => '<h3 style="border: solid 1px #b3b3b3; text-align: center; letter-spacing: 2px;padding:15px 10px; background:#cecece; text-transform:uppercase; margin:10px -20px 5px;">' . __( 'Right Side  &darr;', 'edumodo' ) . '</h3>',
                        'priority'    => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ] );
                    Kirki::add_field( 'edumodo_header_enable_login', [
                        'type'        => 'radio-buttonset',
                        'settings'    => 'edumodo_header_enable_login',
                        'label'       => esc_html__( 'Enable Login & Registration', $this->text_domain ),
                        'section'     => 'edumodo_header_top_bar',
                        'default'     => 'yes',
                        'choices'     => [
                            'yes'   => esc_html__( 'Yes', $this->text_domain ),
                            'no' => esc_html__( 'No', $this->text_domain ),
                        ],
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ] );
                    Kirki::add_field( 'edumodo_top_bar_login_text', [
                        'type'        => 'text',
                        'settings'    => 'edumodo_top_bar_login_text',
                        'label'       => __( 'Login Text', $this->text_domain  ),
                        'description' => esc_html__( 'Login button text', $this->text_domain  ),
                        'section'     => 'edumodo_header_top_bar',
                        'default'     => esc_html__('Login',$this->text_domain ),
                        'priority'    => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ],
                            [
                                'setting'  => 'edumodo_header_enable_login',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ] );
                    Kirki::add_field( 'edumodo_top_bar_login_url', [
                        'type'        => 'link',
                        'settings'    => 'edumodo_top_bar_login_url',
                        'label'       => __( 'Login URL', $this->text_domain  ),
                        'description' => esc_html__( 'Add the login page url here', $this->text_domain  ),
                        'section'     => 'edumodo_header_top_bar',
                        'default'     => esc_html__('#',$this->text_domain ),
                        'priority'    => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ],
                            [
                                'setting'  => 'edumodo_header_enable_login',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ] );
                    Kirki::add_field( 'edumodo_top_bar_register_text', [
                        'type'        => 'text',
                        'settings'    => 'edumodo_top_bar_register_text',
                        'label'       => __( 'Register Text', $this->text_domain  ),
                        'description' => esc_html__( 'Registration button text', $this->text_domain  ),
                        'section'     => 'edumodo_header_top_bar',
                        'default'     => esc_html__('Registration', $this->text_domain ),
                        'priority'    => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ],
                            [
                                'setting'  => 'edumodo_header_enable_login',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                            
                        ]
                    ] );
                    Kirki::add_field( 'edumodo_top_bar_register_url', [
                        'type'        => 'link',
                        'settings'    => 'edumodo_top_bar_register_url',
                        'label'       => __( 'Register URL', $this->text_domain  ),
                        'description' => esc_html__( 'Add the registration page url here', $this->text_domain  ),
                        'section'     => 'edumodo_header_top_bar',
                        'default'     => esc_html__('#', $this->text_domain ),
                        'priority'    => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ],
                            [
                                'setting'  => 'edumodo_header_enable_login',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ] );
                    Kirki::add_field( 'edumodo_top_bar_profile_text', [
                        'type'            => 'link',
                        'settings'        => 'edumodo_top_bar_profile_text',
                        'label'           => __( 'Profile Text', $this->text_domain  ),
                        'description'     => esc_html__( 'After logged in, the user will see the button instead of register button', 'edumodo' ),
                        'section'         => 'edumodo_header_top_bar',
                        'default'         => esc_html__('Profile', $this->text_domain ),
                        'priority'        => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ],
                            [
                                'setting'  => 'edumodo_header_enable_login',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ] );
                    Kirki::add_field( 'edumodo_top_bar_profile_url', [
                        'type'            => 'link',
                        'settings'        => 'edumodo_top_bar_profile_url',
                        'label'           => __( 'Profile Url', $this->text_domain  ),
                        'description'     => esc_html__( 'Profile page URL. After logged in, the user will see the button instead of register button', $this->text_domain  ),
                        'section'         => 'edumodo_header_top_bar',
                        'default'         => esc_html__('#', $this->text_domain ),
                        'priority'        => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ],
                            [
                                'setting'  => 'edumodo_header_enable_login',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ] );

                    Kirki::add_field('edumodo_header_social_enable', [
                        'type'        => 'radio-buttonset',
                        'settings'    => 'edumodo_header_social_enable',
                        'label'       => esc_html__('Enable Social', $this->text_domain),
                        'section'     => 'edumodo_header_top_bar',
                        'default'     => 'yes',
                        'choices'     => [
                            'yes'   => esc_html__('Yes', $this->text_domain),
                            'no' => esc_html__('No', $this->text_domain),
                        ],
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ]);
                    Kirki::add_field('edumodo_social_facebook_url', [
                        'type'     => 'link',
                        'settings' => 'edumodo_social_facebook_url',
                        'label'    => __('Facebook', $this->text_domain),
                        'section'  => 'edumodo_header_top_bar',
                        'default'  => '#',
                        'priority' => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ],
                            [
                                'setting'  => 'edumodo_header_social_enable',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ]);
                    Kirki::add_field('edumodo_social_twitter_url', [
                        'type'     => 'link',
                        'settings' => 'edumodo_social_twitter_url',
                        'label'    => __('Twitter', $this->text_domain),
                        'section'  => 'edumodo_header_top_bar',
                        'default'  => '#',
                        'priority' => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ],
                            [
                                'setting'  => 'edumodo_header_social_enable',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ]);
                    Kirki::add_field('edumodo_social_instagram_url', [
                        'type'     => 'link',
                        'settings' => 'edumodo_social_instagram_url',
                        'label'    => __('Instagram', $this->text_domain),
                        'section'  => 'edumodo_header_top_bar',
                        'default'  => '#',
                        'priority' => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ],
                            [
                                'setting'  => 'edumodo_header_social_enable',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ]);
                    Kirki::add_field('edumodo_social_linkedin_url', [
                        'type'     => 'link',
                        'settings' => 'edumodo_social_linkedin_url',
                        'label'    => __('Linkedin', $this->text_domain),
                        'section'  => 'edumodo_header_top_bar',
                        'default'  => '#',
                        'priority' => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ],
                            [
                                'setting'  => 'edumodo_header_social_enable',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ]);
                    Kirki::add_field('edumodo_social_whatsapp_url', [
                        'type'     => 'link',
                        'settings' => 'edumodo_social_whatsapp_url',
                        'label'    => __('Whatsapp', $this->text_domain),
                        'section'  => 'edumodo_header_top_bar',
                        'default'  => '',
                        'priority' => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ],
                            [
                                'setting'  => 'edumodo_header_social_enable',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ]);
                    Kirki::add_field('edumodo_social_youtube_url', [
                        'type'     => 'link',
                        'settings' => 'edumodo_social_youtube_url',
                        'label'    => __('Youtube', $this->text_domain),
                        'section'  => 'edumodo_header_top_bar',
                        'default'  => '',
                        'priority' => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ],
                            [
                                'setting'  => 'edumodo_header_social_enable',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ]);
                    Kirki::add_field('edumodo_social_skype_url', [
                        'type'     => 'link',
                        'settings' => 'edumodo_social_skype_url',
                        'label'    => __('Skype', $this->text_domain),
                        'section'  => 'edumodo_header_top_bar',
                        'default'  => '',
                        'priority' => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ],
                            [
                                'setting'  => 'edumodo_header_social_enable',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ]);
                    Kirki::add_field('edumodo_social_snapchat_url', [
                        'type'     => 'link',
                        'settings' => 'edumodo_social_snapchat_url',
                        'label'    => __('Snapchat', $this->text_domain),
                        'section'  => 'edumodo_header_top_bar',
                        'default'  => '',
                        'priority' => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ],
                            [
                                'setting'  => 'edumodo_header_social_enable',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ]);
                    Kirki::add_field('edumodo_header_enable_menu', [
                        'type'        => 'radio-buttonset',
                        'settings'    => 'edumodo_header_enable_menu',
                        'label'       => esc_html__('Menu',
                            $this->text_domain
                        ),
                        'section'     => 'edumodo_header_top_bar',
                        'default'     => 'no',
                        'choices'     => [
                            'yes'   => esc_html__('Yes', $this->text_domain),
                            'no' => esc_html__('No', $this->text_domain),
                        ],
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ]);
                    Kirki::add_field('edumodo_header_right_menu', [
                        'type'        => 'select',
                        'settings'    => 'edumodo_header_right_menu',
                        'label'       => esc_html__('Right Menu', $this->text_domain),
                        'section'     => 'edumodo_header_top_bar',
                        'choices'     => $this->edudmodo_get_wp_menus(),
                        'priority'      => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_menu',
                                'operator' => '==',
                                'value'    => 'yes',
                            ],
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ]);
            
                    /**
                     * Style
                     */
                    Kirki::add_field( 'header_top_bar_seperator_3', [
                        'type'        => 'custom',
                        'settings'    => 'header_top_bar_seperator_3',
                        'label'       => esc_html__( '', $this->text_domain  ),
                        'section'     => 'edumodo_header_top_bar',
                        'default'     => '<h3 style="border: solid 1px #b3b3b3; text-align: center; letter-spacing: 2px;padding:15px 10px; background:#cecece; text-transform:uppercase; margin:10px -20px 5px;">' . __( 'Style  &darr;', 'edumodo' ) . '</h3>',
                        'priority'    => 10,
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ] );
                    Kirki::add_field( 'edumodo_top_header_background_color', [
                        'type'        => 'color',
                        'settings'    => 'edumodo_top_header_background_color',
                        'label'       => __( 'Background', $this->text_domain ),
                        'section'     => 'edumodo_header_top_bar',
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ] );
                    Kirki::add_field( 'edumodo_top_header_color', [
                        'type'        => 'color',
                        'settings'    => 'edumodo_top_header_color',
                        'label'       => __( 'Color', $this->text_domain ),
                        'section'     => 'edumodo_header_top_bar',
                        'active_callback' => [
                            [
                                'setting'  => 'edumodo_header_enable_top_bar',
                                'operator' => '==',
                                'value'    => 'yes',
                            ]
                        ]
                    ] );
                    
                    
            #   end of variation region 
        }
    }
?>