<?php 
$wp_customize->add_section(
    'event_area',
    array(
        'title'         => __( 'Events Section', 'Luzuk' ),
        'panel'   => 'luzuk_premium_home_panel',
    )
);
$wp_customize->add_setting(
    'event_area_disable',
    array(
        'sanitize_callback' => 'luzuk_sanitize_text',
        'default' => 'off'
    )
);
$wp_customize->add_control(
    new luzuk_Switch_Control(
        $wp_customize,
        'event_area_disable',
        array(
            'settings'      => 'event_area_disable',
            'section'       => 'event_area',
            'label'         => __( 'Disable Section', 'Luzuk' ),
            'on_off_label'  => array(
                'on' => __( 'Yes', 'Luzuk' ),
                'off' => __( 'No', 'Luzuk' )
            )   
        )
    )
);

backgroundManager($wp_customize, 'event', 'event_area', $color='#fff', get_template_directory_uri().'/images/default-gray.png', 'img');

lzCustomLable($wp_customize, 'luzuk_sec_eventssectionpadding', 'event_area', 'Set Section Padding:');

$wp_customize->add_setting(
    'event_areaTpadding',
    array(
        'sanitize_callback' => 'luzuk_sanitize_text',
        'default'           => __( '4em', 'luzuk-premium' )
    )
);
$wp_customize->add_control(
    'event_areaTpadding',
    array(
        'settings'      => 'event_areaTpadding',
        'section'       => 'event_area',
        'type'          => 'text',
        'label'         => __( 'Top Padding', 'luzuk-premium' )
    )
);
$wp_customize->add_setting(
    'event_areaBpadding',
    array(
        'sanitize_callback' => 'luzuk_sanitize_text',
        'default'           => __( '6em', 'luzuk-premium' )
    )
);
$wp_customize->add_control(
    'event_areaBpadding',
    array(
        'settings'      => 'event_areaBpadding',
        'section'       => 'event_area',
        'type'          => 'text',
        'label'         => __( 'Bottom Padding', 'luzuk-premium' )
    )
);

$wp_customize->add_setting(
    'events_maintitle_subtitle_heading',
    array(
        'sanitize_callback' => 'luzuk_sanitize_text',
    )
);
$wp_customize->add_control(
    new luzuk_Customize_Heading(
        $wp_customize,
        'events_maintitle_subtitle_heading',
        array(
            'settings'      => 'events_maintitle_subtitle_heading',
            'section'       => 'event_area',
            'label'         => __( 'Section Heading', 'Luzuk' ),
        )
    )
);

$wp_customize->add_setting(
    'events_maintitle',
    array(
        'sanitize_callback' => 'luzuk_sanitize_text',
        'default'           => __( 'Latest Event', 'Luzuk' )
    )
);
$wp_customize->add_control(
    'events_maintitle',
    array(
        'settings'      => 'events_maintitle',
        'section'       => 'event_area', 
        'type'          => 'text',
        'label'         => __( 'Section Heading', 'Luzuk' )
    )
);

addColorPalatOption($wp_customize, 'eventarea_sectitle_color', 'event_area', 'Section Heading Color ', '#000');
addColorPalatOption($wp_customize, 'eventarea_secsubtitlebrd_clr', 'event_area', 'Section Heading Border Color ', '#01b9fd');

$wp_customize->add_setting('event_area_lbl2', array('sanitize_callback'=>'luzuk_sanitize_text'));
$wp_customize->add_control(
    new luzuk_Info_Text( 
        $wp_customize,
        'event_area_lbl2',
        array(
            'settings'      => 'event_area_lbl2',
            'section'       => 'event_area',
            'label'         => __( 'Note2:', 'Luzuk' ),  
            'description'   => __( 'Use Shortcode [EVENT] to show all events in a page', 'Luzuk' ),
        )
    )
);

$wp_customize->add_setting('event_npp_heading',array('sanitize_callback' => 'luzuk_sanitize_text'));
$wp_customize->add_control(
    new luzuk_Customize_Heading(
        $wp_customize,
        'event_npp_heading',
        array(
            'settings'      => 'event_npp_heading',
            'section'       => 'event_area',
            'label'         => __( 'Number of Events to show', 'Luzuk' ),
        )
    )
);    
$wp_customize->add_setting('event_npp_count',array('sanitize_callback' => 'luzuk_sanitize_text','default' => 2));
$wp_customize->add_control(
    'event_npp_count',
    array(
        'settings'      => 'event_npp_count',
        'section'       => 'event_area',
        'type'          => 'select',
        'label'         => __( 'Number of events to show', 'Luzuk' ),
        'choices'=>array(1,2,3,4,5,6,7,8,9,10,11,12)
    )
);

$EventsSingleChoice[] = 'Select';
for( $i = 1; $i <= 12; $i++ ){
    $wp_customize->add_setting(
        'events_heading'.$i,
        array(
            'sanitize_callback' => 'luzuk_sanitize_text'
        )
    );
    $wp_customize->add_control(
        new luzuk_Customize_Heading(
            $wp_customize,
            'events_heading'.$i,
            array(
                'settings'      => 'events_heading'.$i,
                'section'       => 'event_area',
                'label'         => __( 'Event Page ', 'Luzuk' ).$i,
            )
        )
    );
    if(is_array($EventsSingleChoice)){
        $wp_customize->add_setting(
            'events_page'.$i,
            array(
                'sanitize_callback' => 'absint'
            )
        );
        $wp_customize->add_control(
            'events_page'.$i,
            array(
                'settings'      => 'events_page'.$i,
                'section'       => 'event_area',
                'type'=> 'select',
                'label'         => __( 'Select A Event Page ', 'Luzuk' ),
                'choices' => $EventsSingleChoice,
            )
        );

// $wp_customize->add_setting(
//         'events_page_icon1'.$i,
//         array(
//             'default'           => 'fa fa-language',
//             'sanitize_callback' => 'luzuk_sanitize_text'
//         )
//     );        
//     $wp_customize->add_control(
//         new luzuk_Fontawesome_Icon_Chooser(
//             $wp_customize,
//             'events_page_icon1'.$i,
//             array(
//                 'settings'      => 'events_page_icon1'.$i,
//                 'section'       => 'event_area',
//                 'type'          => 'icon',
//                 'label'         => __( 'FontAwesome Icon', 'Luzuk' ),
//             )
//         )
//     );

    }else{
        $wp_customize->add_setting('event_area_lbl'.$i, array('sanitize_callback'=>'luzuk_sanitize_text'));
        $wp_customize->add_control(
            new luzuk_Info_Text( 
                $wp_customize,
                'event_area_lbl'.$i,
                array(
                    'settings'      => 'event_area_lbl'.$i,
                    'section'       => 'event_area',
                    'label'         => __( 'Note:', 'Luzuk' ),    
                    'description'   => __( '<strong>Changes will not reflect unless you select the event Page.</strong> <br/>Please add the events from "events menu" and then select events to show information.', 'Luzuk' ),
                )
            )
        );
    }
 
}

lzCustomLable($wp_customize, 'ser_sectioncolor', 'event_area', 'Section Color');

addColorPalatOption($wp_customize, 'events_edbxbgClr', 'event_area', 'Section Box Background Color ', '#fff');

addColorPalatOption($wp_customize, 'events_edtextClr', 'event_area', 'Section Date Text Color ', '#000');

addColorPalatOption($wp_customize, 'events_edphgClr', 'event_area', 'Section Date Highlight Color ', '#01b9fd');

addColorPalatOption($wp_customize, 'events_eTitleClr', 'event_area', 'Section Title Color ', '#000');

addColorPalatOption($wp_customize, 'events_eTitlehvClr', 'event_area', 'Section Title Hover Color ', '#01b9fd');

addColorPalatOption($wp_customize, 'events_etxtClr', 'event_area', 'Section Text Color ', '#858585');

    // button
$wp_customize->add_setting( 'event_button_display' , array( 'default' => true, 'transport' => 'refresh', ) ); $wp_customize->add_control( 'event_button_display', array( 'label' => 'Section Button Display', 'section' => 'event_area', 'settings' => 'event_button_display', 'type' => 'radio', 'choices' => array( 'show' => 'Show Button', 'hide' => 'Hide Button', ), ) );

$wp_customize->add_setting(
        'event_button',
        array(
            'sanitize_callback' => 'luzuk_sanitize_text',
            'default'           => __( 'Read Full', 'Luzuk' )
        )
    );
    $wp_customize->add_control(
        'event_button',
        array(
            'settings'      => 'event_button',
            'section'       => 'event_area',
            'type'          => 'text',
            'label'         => __( 'Add Button Text Here', 'Luzuk' )
        )
    );

addColorPalatOption($wp_customize, 'events_ebtntxtClr', 'event_area', 'Section Button Text Color ', '#fff');

addColorPalatOption($wp_customize, 'events_ebtntxthvClr', 'event_area', 'Section Button Text Hover Color ', '#000');

addColorPalatOption($wp_customize, 'events_ebtnbgClr', 'event_area', 'Section Button background Color ', '#01b9fd');

addColorPalatOption($wp_customize, 'events_ebtnbghvClr', 'event_area', 'Section Button background Hover Color ', '#55e3ca');