<?php
/**
* Header Banner Options.
*
* @package Board Games
*/

$board_games_default = board_games_get_default_theme_options();
$board_games_post_category_list = board_games_post_category_list();

$wp_customize->add_section( 'board_games_header_slider_setting',
    array(
    'title'      => esc_html__( 'Banner Settings', 'board-games' ),
    'priority'   => 10,
    'capability' => 'edit_theme_options',
    'panel'      => 'board_games_theme_home_pannel',
    )
);

// Show/Hide Site Logo
$wp_customize->add_setting('board_games_display_logo', array(
    'default'           => false,
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'board_games_sanitize_checkbox',
));
$wp_customize->add_control('board_games_display_logo', array(
    'label'    => esc_html__('Enable / Disable Site Logo', 'board-games'),
    'section'  => 'title_tagline',
    'type'     => 'checkbox',
));

// Show/Hide Site Title
$wp_customize->add_setting('board_games_display_title', array(
    'default'           => true,
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'board_games_sanitize_checkbox',
));
$wp_customize->add_control('board_games_display_title', array(
    'label'    => esc_html__('Enable / Disable Site Title', 'board-games'),
    'section'  => 'title_tagline',
    'type'     => 'checkbox',
));

// Show/Hide Site Tagline
$wp_customize->add_setting('board_games_display_header_text',
    array(
        'default'           => false,
        'capability' => 'edit_theme_options',
        'sanitize_callback' => 'board_games_sanitize_checkbox',
    )
);
$wp_customize->add_control('board_games_display_header_text',
    array(
        'label' => esc_html__('Enable / Disable Site Tagline', 'board-games'),
        'section' => 'title_tagline',
        'type' => 'checkbox',
    )
);

$wp_customize->add_setting('board_games_header_slider',
    array(
        'default' => $board_games_default['board_games_header_slider'],
        'capability' => 'edit_theme_options',
        'sanitize_callback' => 'board_games_sanitize_checkbox',
    )
);
$wp_customize->add_control('board_games_header_slider',
    array(
        'label' => esc_html__('Enable Banner', 'board-games'),
        'section' => 'board_games_header_slider_setting',
        'type' => 'checkbox',
    )
);

$wp_customize->add_setting( 'board_games_banner_section_heading_1',
    array(
    'default'           => $board_games_default['board_games_banner_section_heading_1'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'board_games_banner_section_heading_1',
    array(
    'label'    => esc_html__( 'Banner Heading 1', 'board-games' ),
    'section'  => 'board_games_header_slider_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'board_games_banner_section_heading_2',
    array(
    'default'           => $board_games_default['board_games_banner_section_heading_2'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'board_games_banner_section_heading_2',
    array(
    'label'    => esc_html__( 'Banner Heading 2', 'board-games' ),
    'section'  => 'board_games_header_slider_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'board_games_banner_section_content',
    array(
    'default'           => $board_games_default['board_games_banner_section_content'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'board_games_banner_section_content',
    array(
    'label'    => esc_html__( 'Banner Content', 'board-games' ),
    'section'  => 'board_games_header_slider_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'board_games_banner_section_button_text',
    array(
    'default'           => $board_games_default['board_games_banner_section_button_text'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'board_games_banner_section_button_text',
    array(
    'label'    => esc_html__( 'Banner Button Text', 'board-games' ),
    'section'  => 'board_games_header_slider_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'board_games_banner_section_button_url',
    array(
    'default'           => $board_games_default['board_games_banner_section_button_url'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'board_games_banner_section_button_url',
    array(
    'label'    => esc_html__( 'Banner Button URL', 'board-games' ),
    'section'  => 'board_games_header_slider_setting',
    'type'     => 'url',
    )
);

//Banner Post 1

$wp_customize->add_setting( 'board_games_banner_section_post_1_heading',
    array(
    'default'           => $board_games_default['board_games_banner_section_post_1_heading'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'board_games_banner_section_post_1_heading',
    array(
    'label'    => esc_html__( 'Banner Post 1 Heading', 'board-games' ),
    'section'  => 'board_games_header_slider_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'board_games_banner_section_post_1_button_text',
    array(
    'default'           => $board_games_default['board_games_banner_section_post_1_button_text'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'board_games_banner_section_post_1_button_text',
    array(
    'label'    => esc_html__( 'Banner Post 1 Button Text', 'board-games' ),
    'section'  => 'board_games_header_slider_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'board_games_banner_section_post_1_button_url',
    array(
    'default'           => $board_games_default['board_games_banner_section_post_1_button_url'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'board_games_banner_section_post_1_button_url',
    array(
    'label'    => esc_html__( 'Banner Post 1 Button URL', 'board-games' ),
    'section'  => 'board_games_header_slider_setting',
    'type'     => 'url',
    )
);

$wp_customize->add_setting('board_games_banner_section_post_1_image',
    array(
        'default' => $board_games_default['board_games_banner_section_post_1_image'],
        'sanitize_callback' => 'esc_url_raw',
    )
);
$wp_customize->add_control(
    new WP_Customize_Image_Control( $wp_customize,'board_games_banner_section_post_1_image',
        array(
            'label' => __('Banner Post Image 1','board-games'),
            'section' => 'board_games_header_slider_setting',
            'settings' => 'board_games_banner_section_post_1_image',
        )
    )
);

//Banner Post 2

$wp_customize->add_setting( 'board_games_banner_section_post_2_heading',
    array(
    'default'           => $board_games_default['board_games_banner_section_post_2_heading'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'board_games_banner_section_post_2_heading',
    array(
    'label'    => esc_html__( 'Banner Post 2 Heading', 'board-games' ),
    'section'  => 'board_games_header_slider_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'board_games_banner_section_post_2_button_text',
    array(
    'default'           => $board_games_default['board_games_banner_section_post_2_button_text'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'board_games_banner_section_post_2_button_text',
    array(
    'label'    => esc_html__( 'Banner Post 2 Button Text', 'board-games' ),
    'section'  => 'board_games_header_slider_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'board_games_banner_section_post_2_button_url',
    array(
    'default'           => $board_games_default['board_games_banner_section_post_2_button_url'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'board_games_banner_section_post_2_button_url',
    array(
    'label'    => esc_html__( 'Banner Post 2 Button URL', 'board-games' ),
    'section'  => 'board_games_header_slider_setting',
    'type'     => 'url',
    )
);

$wp_customize->add_setting('board_games_banner_section_post_2_image',
    array(
        'default' => $board_games_default['board_games_banner_section_post_2_image'],
        'sanitize_callback' => 'esc_url_raw',
    )
);
$wp_customize->add_control(
    new WP_Customize_Image_Control( $wp_customize,'board_games_banner_section_post_2_image',
        array(
            'label' => __('Banner Post Image 2','board-games'),
            'section' => 'board_games_header_slider_setting',
            'settings' => 'board_games_banner_section_post_2_image',
        )
    )
);

//Banner Post 3

$wp_customize->add_setting( 'board_games_banner_section_post_3_heading',
    array(
    'default'           => $board_games_default['board_games_banner_section_post_3_heading'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'board_games_banner_section_post_3_heading',
    array(
    'label'    => esc_html__( 'Banner Post 3 Heading', 'board-games' ),
    'section'  => 'board_games_header_slider_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'board_games_banner_section_post_3_button_text',
    array(
    'default'           => $board_games_default['board_games_banner_section_post_3_button_text'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'board_games_banner_section_post_3_button_text',
    array(
    'label'    => esc_html__( 'Banner Post 3 Button Text', 'board-games' ),
    'section'  => 'board_games_header_slider_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'board_games_banner_section_post_3_button_url',
    array(
    'default'           => $board_games_default['board_games_banner_section_post_3_button_url'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'board_games_banner_section_post_3_button_url',
    array(
    'label'    => esc_html__( 'Banner Post 3 Button URL', 'board-games' ),
    'section'  => 'board_games_header_slider_setting',
    'type'     => 'url',
    )
);

$wp_customize->add_setting('board_games_banner_section_post_3_image',
    array(
        'default' => $board_games_default['board_games_banner_section_post_3_image'],
        'sanitize_callback' => 'esc_url_raw',
    )
);
$wp_customize->add_control(
    new WP_Customize_Image_Control( $wp_customize,'board_games_banner_section_post_3_image',
        array(
            'label' => __('Banner Post Image 3','board-games'),
            'section' => 'board_games_header_slider_setting',
            'settings' => 'board_games_banner_section_post_3_image',
        )
    )
);

//Banner Post 4

$wp_customize->add_setting( 'board_games_banner_section_post_4_heading',
    array(
    'default'           => $board_games_default['board_games_banner_section_post_4_heading'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'board_games_banner_section_post_4_heading',
    array(
    'label'    => esc_html__( 'Banner Post 4 Heading', 'board-games' ),
    'section'  => 'board_games_header_slider_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'board_games_banner_section_post_4_button_text',
    array(
    'default'           => $board_games_default['board_games_banner_section_post_4_button_text'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'board_games_banner_section_post_4_button_text',
    array(
    'label'    => esc_html__( 'Banner Post 4 Button Text', 'board-games' ),
    'section'  => 'board_games_header_slider_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'board_games_banner_section_post_4_button_url',
    array(
    'default'           => $board_games_default['board_games_banner_section_post_4_button_url'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'board_games_banner_section_post_4_button_url',
    array(
    'label'    => esc_html__( 'Banner Post 4 Button URL', 'board-games' ),
    'section'  => 'board_games_header_slider_setting',
    'type'     => 'url',
    )
);

$wp_customize->add_setting('board_games_banner_section_post_4_image',
    array(
        'default' => $board_games_default['board_games_banner_section_post_4_image'],
        'sanitize_callback' => 'esc_url_raw',
    )
);
$wp_customize->add_control(
    new WP_Customize_Image_Control( $wp_customize,'board_games_banner_section_post_4_image',
        array(
            'label' => __('Banner Post Image 4','board-games'),
            'section' => 'board_games_header_slider_setting',
            'settings' => 'board_games_banner_section_post_4_image',
        )
    )
);


// Product Settings

$wp_customize->add_section( 'board_games_about_setion_setting',
    array(
    'title'      => esc_html__( 'Product Settings', 'board-games' ),
    'priority'   => 10,
    'capability' => 'edit_theme_options',
    'panel'      => 'board_games_theme_home_pannel',
    )
);

$wp_customize->add_setting( 'board_games_product_section_short_title',
    array(
    'default'           => $board_games_default['board_games_product_section_short_title'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'board_games_product_section_short_title',
    array(
    'label'    => esc_html__( 'Product Short Heading ', 'board-games' ),
    'section'  => 'board_games_about_setion_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'board_games_product_section_heading',
    array(
    'default'           => $board_games_default['board_games_product_section_heading'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'board_games_product_section_heading',
    array(
    'label'    => esc_html__( 'Product Heading ', 'board-games' ),
    'section'  => 'board_games_about_setion_setting',
    'type'     => 'text',
    )
);

$board_games_args = array(
    'type'                     => 'product',
    'child_of'                 => 0,
    'parent'                   => '',
    'orderby'                  => 'term_group',
    'order'                    => 'ASC',
    'hide_empty'               => false,
    'hierarchical'             => 1,
    'number'                   => '',
    'taxonomy'                 => 'product_cat',
    'pad_counts'               => false
);

$board_games_categories = get_categories($board_games_args);
$board_games_cat_posts = array();
$board_games_m = 0;
$board_games_cat_posts[]='Select';
foreach($board_games_categories as $board_games_category){
    if($board_games_m==0){
        $board_games_default = $board_games_category->slug;
        $board_games_m++;
    }
    $board_games_cat_posts[$board_games_category->slug] = $board_games_category->name;
}

$wp_customize->add_setting('board_games_featured_product_category',array(
    'default'   => 'select',
    'sanitize_callback' => 'board_games_sanitize_select',
));
$wp_customize->add_control('board_games_featured_product_category',array(
    'type'    => 'select',
    'choices' => $board_games_cat_posts,
    'label' => __('Select category to display products ','board-games'),
    'section' => 'board_games_about_setion_setting',
));