<?php 
/**
 *  Faced Breadcrumb Settings Option
 *
 * @since Faced 1.0.0
 *
 */
/*Breadcrumb Options*/
$wp_customize->add_section( 'faced_breadcrumb_options', array(
    'priority'       => 50,
    'capability'     => 'edit_theme_options',
    'theme_supports' => '',
    'title'          => __( 'Breadcrumb Options', 'faced' ),
    'panel'          => 'faced_panel',
) );

/*Breadcrumb Enable*/
$wp_customize->add_setting( 'faced_options[faced-blog-site-breadcrumb]', array(
    'capability'        => 'edit_theme_options',
    'transport' => 'refresh',
    'default'           => $default['faced-blog-site-breadcrumb'],
    'sanitize_callback' => 'faced_sanitize_checkbox'
) );
$wp_customize->add_control( 'faced_options[faced-blog-site-breadcrumb]', array(
    'label'     => __( 'Enable Breadcrumb', 'faced' ),
    'description' => __( 'Breadcrumb will appear on all pages except home page. You can use  Yoast SEO, Rank Math or Breadcrumb NavXT plugin breadcrumb as well. Install the plugin and activate the breadcrumb from the settings.', 'faced' ),
    'section'   => 'faced_breadcrumb_options',
    'settings'  => 'faced_options[faced-blog-site-breadcrumb]',
    'type'      => 'checkbox',
    'priority'  => 15,
) );

/*callback functions breadcrumb enable*/
if ( !function_exists('faced_breadcrumb_selection_enable') ) :
  function faced_breadcrumb_selection_enable(){
      global $faced_theme_options;
      $faced_theme_options = faced_get_options_value();
      $enable_bc = absint($faced_theme_options['faced-blog-site-breadcrumb']);
      if( $enable_bc == true){
          return true;
      }
      else{
          return false;
      }
  }
endif;

/*Show Breadcrumb Types Selection*/
$wp_customize->add_setting( 'faced_options[faced-breadcrumb-display-from-option]', array(
    'capability'        => 'edit_theme_options',
    'transport' => 'refresh',
    'default'           => $default['faced-breadcrumb-display-from-option'],
    'sanitize_callback' => 'faced_sanitize_select'
) );
$wp_customize->add_control( 'faced_options[faced-breadcrumb-display-from-option]', array(
    'choices' => array(
        'theme-default'    => __('Theme Default Breadcrumb','faced'),
        'yoast-breadcrumb'    => __('Yoast SEO Breadcrumb','faced'),
        'rankmath-breadcrumb'    => __('Rank Math Breadcrumb','faced'),
        'breadcrumb-navxt'    => __('NavXT Breadcrumb','faced'),
    ),
    'label'     => __( 'Select the Breadcrumb Show Option', 'faced' ),
    'description' => __('Theme has its own breadcrumb. If you want to use the plugin breadcrumb, you need to enable the breadcrumb on the respected plugins first. Check plugin settings and enable it.', 'faced'),
    'section'   => 'faced_breadcrumb_options',
    'settings'  => 'faced_options[faced-breadcrumb-display-from-option]',
    'type'      => 'select',
    'priority'  => 15,
    'active_callback'=> 'faced_breadcrumb_selection_enable',
) );

/*Breadcrumb Text*/
$wp_customize->add_setting( 'faced_options[faced-breadcrumb-text]', array(
    'capability'        => 'edit_theme_options',
    'transport' => 'refresh',
    'default'           => $default['faced-breadcrumb-text'],
    'sanitize_callback' => 'sanitize_text_field'
) );
$wp_customize->add_control( 'faced_options[faced-breadcrumb-text]', array(
    'label'     => __( 'Breadcrumb Text', 'faced' ),
    'description' => __( 'Write your own text in place of You are Here', 'faced' ),
    'section'   => 'faced_breadcrumb_options',
    'settings'  => 'faced_options[faced-breadcrumb-text]',
    'type'      => 'text',
    'priority'  => 15,
    'active_callback' => 'faced_breadcrumb_selection_enable',
) );
