<?php
/**
* Header Banner Options.
*
* @package Aerial Drone
*/

$aerial_drone_default = aerial_drone_get_default_theme_options();
$aerial_drone_post_category_list = aerial_drone_post_category_list();

$wp_customize->add_section( 'header_banner_setting',
    array(
    'title'      => esc_html__( 'Slider Settings', 'aerial-drone' ),
    'priority'   => 10,
    'capability' => 'edit_theme_options',
    'panel'      => 'theme_home_pannel',
    )
);

// Show/Hide Site Logo
$wp_customize->add_setting('aerial_drone_display_logo', array(
    'default'           => false,
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'aerial_drone_sanitize_checkbox',
));
$wp_customize->add_control('aerial_drone_display_logo', array(
    'label'    => esc_html__('Enable / Disable Site Logo', 'aerial-drone'),
    'section'  => 'title_tagline',
    'type'     => 'checkbox',
));

// Show/Hide Site Title
$wp_customize->add_setting('aerial_drone_display_title', array(
    'default'           => true,
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'aerial_drone_sanitize_checkbox',
));
$wp_customize->add_control('aerial_drone_display_title', array(
    'label'    => esc_html__('Enable / Disable Site Title', 'aerial-drone'),
    'section'  => 'title_tagline',
    'type'     => 'checkbox',
));

// Show/Hide Site Tagline
$wp_customize->add_setting('aerial_drone_display_header_text',
    array(
        'default'           => false,
        'capability' => 'edit_theme_options',
        'sanitize_callback' => 'aerial_drone_sanitize_checkbox',
    )
);
$wp_customize->add_control('aerial_drone_display_header_text',
    array(
        'label' => esc_html__('Enable / Disable Site Tagline', 'aerial-drone'),
        'section' => 'title_tagline',
        'type' => 'checkbox',
    )
);

$wp_customize->add_setting('aerial_drone_header_slider',
    array(
        'default' => $aerial_drone_default['aerial_drone_header_slider'],
        'capability' => 'edit_theme_options',
        'sanitize_callback' => 'aerial_drone_sanitize_checkbox',
    )
);
$wp_customize->add_control('aerial_drone_header_slider',
    array(
        'label' => esc_html__('Enable Slider', 'aerial-drone'),
        'section' => 'header_banner_setting',
        'type' => 'checkbox',
    )
);

$wp_customize->add_setting('aerial_drone_banner_background_image',
    array(
        'default' => $aerial_drone_default['aerial_drone_banner_background_image'],
        'sanitize_callback' => 'esc_url_raw',
    )
);
$wp_customize->add_control(
    new WP_Customize_Image_Control( $wp_customize,'aerial_drone_banner_background_image',
        array(
            'label' => __('Slider Background Image','aerial-drone'),
            'section' => 'header_banner_setting',
            'settings' => 'aerial_drone_banner_background_image',
        )
    )
);

$wp_customize->add_setting( 'aerial_drone_header_banner_cat',
    array(
    'default'           => '',
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'aerial_drone_sanitize_select',
    )
);
$wp_customize->add_control( 'aerial_drone_header_banner_cat',
    array(
    'label'       => esc_html__( 'Slider Post Category', 'aerial-drone' ),
    'section'     => 'header_banner_setting',
    'type'        => 'select',
    'choices'     => $aerial_drone_post_category_list,
    )
);

$wp_customize->add_setting( 'aerial_drone_slider_short_heading',
    array(
    'default'           => $aerial_drone_default['aerial_drone_slider_short_heading'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'aerial_drone_slider_short_heading',
    array(
    'label'    => esc_html__( 'Short Heading ', 'aerial-drone' ),
    'section'  => 'header_banner_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'aerial_drone_slider_video_button_url',
    array(
    'default'           => '#',
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'aerial_drone_slider_video_button_url',
    array(
    'label'    => esc_html__( 'Video Url', 'aerial-drone' ),
    'section'  => 'header_banner_setting',
    'type'     => 'url',
    )
);

// Showcase Setting

$wp_customize->add_section( 'product_column_setting',
    array(
    'title'      => esc_html__( 'Showcase Setting', 'aerial-drone' ),
    'priority'   => 10,
    'capability' => 'edit_theme_options',
    'panel'      => 'theme_home_pannel',
    )
);

$wp_customize->add_setting( 'aerial_drone_team_section_subtitle',
    array(
    'default'           => $aerial_drone_default['aerial_drone_team_section_subtitle'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'aerial_drone_team_section_subtitle',
    array(
    'label'    => esc_html__( 'Sub Title ', 'aerial-drone' ),
    'section'  => 'product_column_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'aerial_drone_team_section_title',
    array(
    'default'           => $aerial_drone_default['aerial_drone_team_section_title'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'aerial_drone_team_section_title',
    array(
    'label'    => esc_html__( 'Title ', 'aerial-drone' ),
    'section'  => 'product_column_setting',
    'type'     => 'text',
    )
);

$categories = get_categories();
$cat_post = array();
$cat_post[]= 'select';
$m = 0;
foreach($categories as $category){
    if($m==0){
        $default = $category->slug;
        $m++;
    }
    $cat_post[$category->slug] = $category->name;
}

$wp_customize->add_setting('aerial_drone_locations_post_cat',array(
    'default'   => 'uncategorized',
    'sanitize_callback' => 'aerial_drone_sanitize_select',
));
$wp_customize->add_control('aerial_drone_locations_post_cat' ,array(
    'type'    => 'select',
    'choices' => $cat_post,
    'label' => __('Select Category to display Showcase','aerial-drone'),
    'section' => 'product_column_setting',
));

for($i=1; $i<= 6; $i++) {

    $wp_customize->add_setting( 'aerial_drone_showcase_video_button_url' .$i,
        array(
        'default'           => '#',
        'capability'        => 'edit_theme_options',
        'sanitize_callback' => 'sanitize_text_field',
        )
    );
    $wp_customize->add_control( 'aerial_drone_showcase_video_button_url' .$i,
        array(
        'label'    => esc_html__( 'Video Url ', 'aerial-drone' ) .$i,
        'section'  => 'product_column_setting',
        'type'     => 'url',
        )
    );
}