<?php
/**
* Header Banner Options.
*
* @package Event Decorations
*/

$event_decorations_default = event_decorations_get_default_theme_options();
$event_decorations_post_category_list = event_decorations_post_category_list();

$wp_customize->add_section( 'event_decorations_header_slider_setting',
    array(
    'title'      => esc_html__( 'Slider Settings', 'event-decorations' ),
    'priority'   => 10,
    'capability' => 'edit_theme_options',
    'panel'      => 'event_decorations_theme_home_pannel',
    )
);

// Show/Hide Site Logo
$wp_customize->add_setting('event_decorations_display_logo', array(
    'default'           => false,
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'event_decorations_sanitize_checkbox',
));
$wp_customize->add_control('event_decorations_display_logo', array(
    'label'    => esc_html__('Enable / Disable Site Logo', 'event-decorations'),
    'section'  => 'title_tagline',
    'type'     => 'checkbox',
));

// Show/Hide Site Title
$wp_customize->add_setting('event_decorations_display_title', array(
    'default'           => true,
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'event_decorations_sanitize_checkbox',
));
$wp_customize->add_control('event_decorations_display_title', array(
    'label'    => esc_html__('Enable / Disable Site Title', 'event-decorations'),
    'section'  => 'title_tagline',
    'type'     => 'checkbox',
));

// Show/Hide Site Tagline
$wp_customize->add_setting('event_decorations_display_header_text',
    array(
        'default'           => false,
        'capability' => 'edit_theme_options',
        'sanitize_callback' => 'event_decorations_sanitize_checkbox',
    )
);
$wp_customize->add_control('event_decorations_display_header_text',
    array(
        'label' => esc_html__('Enable / Disable Site Tagline', 'event-decorations'),
        'section' => 'title_tagline',
        'type' => 'checkbox',
    )
);

$wp_customize->add_setting('event_decorations_header_slider',
    array(
        'default' => $event_decorations_default['event_decorations_header_slider'],
        'capability' => 'edit_theme_options',
        'sanitize_callback' => 'event_decorations_sanitize_checkbox',
    )
);
$wp_customize->add_control('event_decorations_header_slider',
    array(
        'label' => esc_html__('Enable Slider', 'event-decorations'),
        'section' => 'event_decorations_header_slider_setting',
        'type' => 'checkbox',
    )
);

$wp_customize->add_setting( 'event_decorations_slider_section_short_title',
    array(
    'default'           => $event_decorations_default['event_decorations_slider_section_short_title'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'event_decorations_slider_section_short_title',
    array(
    'label'    => esc_html__( 'Slider Short Title', 'event-decorations' ),
    'section'  => 'event_decorations_header_slider_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'event_decorations_header_banner_cat',
    array(
    'default'           => '',
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'event_decorations_sanitize_select',
    )
);
$wp_customize->add_control( 'event_decorations_header_banner_cat',
    array(
    'label'       => esc_html__( 'Slider Post Category', 'event-decorations' ),
    'section'     => 'event_decorations_header_slider_setting',
    'type'        => 'select',
    'choices'     => $event_decorations_post_category_list,
    )
);

$wp_customize->add_setting( 'event_decorations_slider_section_bottom_text',
    array(
    'default'           => $event_decorations_default['event_decorations_slider_section_bottom_text'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'event_decorations_slider_section_bottom_text',
    array(
    'label'    => esc_html__( 'Slider Contact Text', 'event-decorations' ),
    'section'  => 'event_decorations_header_slider_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'event_decorations_slider_section_button_text',
    array(
    'default'           => $event_decorations_default['event_decorations_slider_section_button_text'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'event_decorations_slider_section_button_text',
    array(
    'label'    => esc_html__( 'Contact Button Text', 'event-decorations' ),
    'section'  => 'event_decorations_header_slider_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'event_decorations_slider_section_button_url',
    array(
    'default'           => $event_decorations_default['event_decorations_slider_section_button_url'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'event_decorations_slider_section_button_url',
    array(
    'label'    => esc_html__( 'Contact Button URL', 'event-decorations' ),
    'section'  => 'event_decorations_header_slider_setting',
    'type'     => 'url',
    )
);

// Product Settings

$wp_customize->add_section( 'event_decorations_about_setion_setting',
    array(
    'title'      => esc_html__( 'Product Settings', 'event-decorations' ),
    'priority'   => 10,
    'capability' => 'edit_theme_options',
    'panel'      => 'event_decorations_theme_home_pannel',
    )
);

$wp_customize->add_setting( 'event_decorations_about_us_section_title',
    array(
    'default'           => $event_decorations_default['event_decorations_about_us_section_title'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'event_decorations_about_us_section_title',
    array(
    'label'    => esc_html__( 'Product Heading ', 'event-decorations' ),
    'section'  => 'event_decorations_about_setion_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'event_decorations_team_section_subtitle',
    array(
    'default'           => $event_decorations_default['event_decorations_team_section_subtitle'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'event_decorations_team_section_subtitle',
    array(
    'label'    => esc_html__( 'Product Content ', 'event-decorations' ),
    'section'  => 'event_decorations_about_setion_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'event_decorations_team_section_button_text',
    array(
    'default'           => $event_decorations_default['event_decorations_team_section_button_text'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'event_decorations_team_section_button_text',
    array(
    'label'    => esc_html__( 'Product Button Text ', 'event-decorations' ),
    'section'  => 'event_decorations_about_setion_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'event_decorations_team_section_button_url',
    array(
    'default'           => $event_decorations_default['event_decorations_team_section_button_url'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'event_decorations_team_section_button_url',
    array(
    'label'    => esc_html__( 'Product Button Url ', 'event-decorations' ),
    'section'  => 'event_decorations_about_setion_setting',
    'type'     => 'text',
    )
);

$event_decorations_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
);

$event_decorations_categories = get_categories($event_decorations_args);
$event_decorations_cat_posts = array();
$event_decorations_m = 0;
$event_decorations_cat_posts[]='Select';
foreach($event_decorations_categories as $event_decorations_category){
    if($event_decorations_m==0){
        $event_decorations_default = $event_decorations_category->slug;
        $event_decorations_m++;
    }
    $event_decorations_cat_posts[$event_decorations_category->slug] = $event_decorations_category->name;
}

$wp_customize->add_setting('event_decorations_featured_product_category',array(
    'default'   => 'select',
    'sanitize_callback' => 'event_decorations_sanitize_select',
));
$wp_customize->add_control('event_decorations_featured_product_category',array(
    'type'    => 'select',
    'choices' => $event_decorations_cat_posts,
    'label' => __('Select category to display products ','event-decorations'),
    'section' => 'event_decorations_about_setion_setting',
));