<?php
/**
 * Slider Section
 *
 */
$wp_customize->add_section(
    'sewa_slider_section',
    array(
        'title'     => esc_html__('Slider Setting Option', 'sewa'),
        'panel'     => 'sewa_theme_options',
        'priority'  => 4,
    )
);
/**
 * Homepage Slider Repeater Section
 *
 */
$slider_pages = array();
$slider_pages_obj = get_pages();
$slider_pages[''] = esc_html__('Select Page For Slider','sewa');
foreach ($slider_pages_obj as $sewa_page) {
    $slider_pages[$sewa_page->ID] = $sewa_page->post_title;
}
$wp_customize->add_setting(
    'sewa_slider_option',
    array(
    'sanitize_callback' => 'sewa_sanitize_slider_data',
    'default'           => $default['sewa_slider_option']
) );
$wp_customize->add_control(
    new PT_Repeater_Control(
        $wp_customize,
        'sewa_slider_option',
        array(
            'label'                      => __('Slider Page Selection Section','sewa'),
            'description'                => __('Select Page For Slider Having Featured Image. You can drag to reposition the slider items','sewa'),
            'section'                    => 'sewa_slider_section',
            'settings'                   => 'sewa_slider_option',
            'repeater_main_label'        => __('Select Page For Slider ','sewa'),
            'repeater_add_control_field' => __('Add New Slide','sewa')
        ),
        array(
            'selectpage'                 => array(
            'type'                       => 'select',
            'label'                      => __( 'Select Page For Slide', 'sewa' ),
            'options'                    => $slider_pages
            ),
            'button_text'                => array(
            'type'                       => 'text',
            'label'                      => __( 'Button Text', 'sewa' ),
            ),
            'button_link'                => array(
            'type'                       => 'url',
            'label'                      => __( 'Button Link', 'sewa' ),
            ),
        )
    )
);

/**
 * Homepage Slider Section Show
 *
 */
$wp_customize->add_setting(
    'sewa_homepage_slider_option',
    array(
        'default'           => $default['sewa_homepage_slider_option'],
        'sanitize_callback' => 'sewa_sanitize_select',
    )
);
$hide_show_option = sewa_slider_option();
$wp_customize->add_control(
    'sewa_homepage_slider_option',
    array(
        'type'        => 'radio',
        'label'       => esc_html__('Slider Option', 'sewa'),
        'description' => esc_html__('Show/hide option for homepage Slider Section.', 'sewa'),
        'section'     => 'sewa_slider_section',
        'choices'     => $hide_show_option,
        'priority'    => 7
    )
);
    



