<?php
/**
* Header Banner Options.
*
* @package Digital Media
*/

$digital_media_default = digital_media_get_default_theme_options();
$digital_media_post_category_list = digital_media_post_category_list();

$wp_customize->add_section( 'header_banner_setting',
    array(
    'title'      => esc_html__( 'Slider Settings', 'digital-media' ),
    'priority'   => 10,
    'capability' => 'edit_theme_options',
    'panel'      => 'digital_media_theme_home_pannel',
    )
);

// Show/Hide Site Logo
$wp_customize->add_setting('digital_media_display_logo', array(
    'default'           => false,
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'digital_media_sanitize_checkbox',
));
$wp_customize->add_control('digital_media_display_logo', array(
    'label'    => esc_html__('Enable / Disable Site Logo', 'digital-media'),
    'section'  => 'title_tagline',
    'type'     => 'checkbox',
));

// Show/Hide Site Title
$wp_customize->add_setting('digital_media_display_title', array(
    'default'           => true,
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'digital_media_sanitize_checkbox',
));
$wp_customize->add_control('digital_media_display_title', array(
    'label'    => esc_html__('Enable / Disable Site Title', 'digital-media'),
    'section'  => 'title_tagline',
    'type'     => 'checkbox',
));

// Show/Hide Site Tagline
$wp_customize->add_setting('digital_media_display_header_text',
    array(
        'default'           => false,
        'capability' => 'edit_theme_options',
        'sanitize_callback' => 'digital_media_sanitize_checkbox',
    )
);
$wp_customize->add_control('digital_media_display_header_text',
    array(
        'label' => esc_html__('Enable / Disable Site Tagline', 'digital-media'),
        'section' => 'title_tagline',
        'type' => 'checkbox',
    )
);

$wp_customize->add_setting('digital_media_header_slider',
    array(
        'default' => $digital_media_default['digital_media_header_slider'],
        'capability' => 'edit_theme_options',
        'sanitize_callback' => 'digital_media_sanitize_checkbox',
    )
);
$wp_customize->add_control('digital_media_header_slider',
    array(
        'label' => esc_html__('Enable Slider', 'digital-media'),
        'section' => 'header_banner_setting',
        'type' => 'checkbox',
    )
);

$wp_customize->add_setting('digital_media_banner_background_image',
    array(
        'default' => $digital_media_default['digital_media_banner_background_image'],
        'sanitize_callback' => 'esc_url_raw',
    )
);
$wp_customize->add_control(
    new WP_Customize_Image_Control( $wp_customize,'digital_media_banner_background_image',
        array(
            'label' => __('Slider Background Image','digital-media'),
            'section' => 'header_banner_setting',
            'settings' => 'digital_media_banner_background_image',
        )
    )
);

$wp_customize->add_setting( 'digital_media_header_banner_cat',
    array(
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'digital_media_sanitize_select',
    )
);
$wp_customize->add_control( 'digital_media_header_banner_cat',
    array(
    'label'       => esc_html__( 'Slider Post Left Category', 'digital-media' ),
    'section'     => 'header_banner_setting',
    'type'        => 'select',
    'choices'     => $digital_media_post_category_list,
    )
);

$wp_customize->add_setting( 'digital_media_header_phone_number',
    array(
    'default'           => $digital_media_default['digital_media_header_phone_number'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'digital_media_header_phone_number',
    array(
    'label'    => esc_html__( 'Phone Number', 'digital-media' ),
    'section'  => 'header_banner_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'digital_media_header_email_id',
    array(
    'default'           => $digital_media_default['digital_media_header_email_id'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'digital_media_header_email_id',
    array(
    'label'    => esc_html__( 'Email Id', 'digital-media' ),
    'section'  => 'header_banner_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'digital_media_header_location',
    array(
    'default'           => $digital_media_default['digital_media_header_location'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'digital_media_header_location',
    array(
    'label'    => esc_html__( 'Address', 'digital-media' ),
    'section'  => 'header_banner_setting',
    'type'     => 'text',
    )
);


// Case Studies Setting

$wp_customize->add_section( 'product_column_setting',
    array(
    'title'      => esc_html__( 'Case Studies Setting', 'digital-media' ),
    'priority'   => 10,
    'capability' => 'edit_theme_options',
    'panel'      => 'digital_media_theme_home_pannel',
    )
);

$wp_customize->add_setting('digital_media_header_case_studies',
    array(
        'default' => $digital_media_default['digital_media_header_case_studies'],
        'capability' => 'edit_theme_options',
        'sanitize_callback' => 'digital_media_sanitize_checkbox',
    )
);
$wp_customize->add_control('digital_media_header_case_studies',
    array(
        'label' => esc_html__('Enable Case Studies', 'digital-media'),
        'section' => 'product_column_setting',
        'type' => 'checkbox',
    )
);


$wp_customize->add_setting( 'digital_media_team_section_subtitle',
    array(
    'default'           => $digital_media_default['digital_media_team_section_subtitle'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'digital_media_team_section_subtitle',
    array(
    'label'    => esc_html__( 'Sub Title ', 'digital-media' ),
    'section'  => 'product_column_setting',
    'type'     => 'text',
    )
);

$wp_customize->add_setting( 'digital_media_team_section_title',
    array(
    'default'           => $digital_media_default['digital_media_team_section_title'],
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control( 'digital_media_team_section_title',
    array(
    'label'    => esc_html__( 'Title ', 'digital-media' ),
    'section'  => 'product_column_setting',
    'type'     => 'text',
    )
);

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

    $wp_customize->add_setting('digital_media_price_list_tab_title'.$i,array(
      'sanitize_callback' => 'sanitize_text_field',
    ));
    $wp_customize->add_control('digital_media_price_list_tab_title'.$i,array(
      'label' => __('Case Studies Tab Heading ','digital-media').$i,
      'section' => 'product_column_setting',
      'setting' => 'digital_media_price_list_tab_title'.$i,
      '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('digital_media_category_tab1',array(
        'default'   => 'Web Design',
        'sanitize_callback' => 'digital_media_sanitize_select',
    ));
    $wp_customize->add_control('digital_media_category_tab1' ,array(
        'type'    => 'select',
        'choices' => $cat_post,
        'label' => __('Select Category to display Case Studies 1','digital-media'),
        'section' => 'product_column_setting',
    ));

    $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('digital_media_category_tab2',array(
        'default'   => 'uncategorized',
        'sanitize_callback' => 'digital_media_sanitize_select',
    ));
    $wp_customize->add_control('digital_media_category_tab2',array(
        'type'    => 'select',
        'choices' => $cat_post,
        'label' => __('Select Category to display Case Studies 2','digital-media'),
        'section' => 'product_column_setting',
    ));

     $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('digital_media_category_tab3',array(
        'default'   => 'Web Design',
        'sanitize_callback' => 'digital_media_sanitize_select',
    ));
    $wp_customize->add_control('digital_media_category_tab3',array(
        'type'    => 'select',
        'choices' => $cat_post,
        'label' => __('Select Category to display Case Studies 3','digital-media'),
        'section' => 'product_column_setting',
    ));

     $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('digital_media_category_tab4',array(
        'sanitize_callback' => 'digital_media_sanitize_select',
    ));
    $wp_customize->add_control('digital_media_category_tab4',array(
        'type'    => 'select',
        'choices' => $cat_post,
        'label' => __('Select Category to display Case Studies 4','digital-media'),
        'section' => 'product_column_setting',
    ));