<?php
/**
 *  Faced Slider Featured Section Option
 *
 * @since Faced 1.0.0
 *
 */
/*Slider Options*/
$wp_customize->add_section( 'faced_slider_section', array(
 'priority'       => 20,
 'capability'     => 'edit_theme_options',
 'theme_supports' => '',
 'title'          => __( 'Slider Section Options', 'faced' ),
 'panel' 		 => 'faced_panel',
) );
/*callback functions slider*/
if ( !function_exists('faced_slider_active_callback') ) :
  function faced_slider_active_callback(){
    global $faced_theme_options;
    $faced_theme_options = faced_get_options_value();
    $enable_slider = absint($faced_theme_options['faced-enable-slider']);
    if( true == $enable_slider ){
      return true;
    }
    else{
      return false;
    }
  }
endif;
/*Slider Enable Option*/
$wp_customize->add_setting( 'faced_options[faced-enable-slider]', array(
 'capability'        => 'edit_theme_options',
 'transport' => 'refresh',
 'default'           => $default['faced-enable-slider'],
 'sanitize_callback' => 'faced_sanitize_checkbox'
) );
$wp_customize->add_control( 'faced_options[faced-enable-slider]', array(
 'label'     => __( 'Enable Slider Section', 'faced' ),
 'description' => __('Checked to show slider section in Home Page.', 'faced'),
 'section'   => 'faced_slider_section',
 'settings'  => 'faced_options[faced-enable-slider]',
 'type'      => 'checkbox',
 'priority'  => 10,
) );

/*Slider Category Selection*/
$wp_customize->add_setting( 'faced_options[faced-select-category]', array(
  'capability'        => 'edit_theme_options',
  'transport' => 'refresh',
  'default'           => $default['faced-select-category'],
  'sanitize_callback' => 'absint'
) );
$wp_customize->add_control(
  new Faced_Customize_Category_Dropdown_Control(
    $wp_customize,
    'faced_options[faced-select-category]',
    array(
      'label'     => __( 'Select Category For Slider Section', 'faced' ),
      'description' => __('From the dropdown select the category for the featured left section. Category having post will display in below dropdown.', 'faced'),
      'section'   => 'faced_slider_section',
      'settings'  => 'faced_options[faced-select-category]',
      'type'      => 'category_dropdown',
      'priority'  => 10,
      'active_callback'=>'faced_slider_active_callback'
    )
  )
);

/*Slider image size*/
$wp_customize->add_setting( 'faced_options[faced-image-size-slider]', array(
    'capability'        => 'edit_theme_options',
    'transport' => 'refresh',
    'default'           => $default['faced-image-size-slider'],
    'sanitize_callback' => 'faced_sanitize_select'
) );
$wp_customize->add_control( 'faced_options[faced-image-size-slider]', array(
   'choices' => array(
    'cropped-image'    => __('Cropped Image','faced'),
    'original-image'   => __('Original Image','faced'),
),
   'label'     => __( 'Size of the image, either cropped or original', 'faced' ),
   'description' => __('The image will be either cropped or original size based on the image. Recommended image size is 1170*606 px. Make the image with this size and add in the featured image.', 'faced'),
   'section'   => 'faced_slider_section',
   'settings'  => 'faced_options[faced-image-size-slider]',
   'type'      => 'select',
   'priority'  => 10,
   'active_callback'=>'faced_slider_active_callback'
) );
