<?php
/**
 * Banner Settings
 *
 * @package Travel Tour
 */
add_action( 'customize_register', 'travel_tour_customize_banner_section' );

function travel_tour_customize_banner_section( $wp_customize ) {

  $wp_customize->get_section( 'header_image' )->panel = "travel_tour_homepage_panel";
  $wp_customize->get_section( 'header_image' )->title = esc_html__( "Banner Section", 'travel-tour' );
  $wp_customize->get_section( 'header_image' )->priority = 1;

  $wp_customize->add_setting( 'banner_section_display_option', array(
      'sanitize_callback'     =>  'travel_tour_sanitize_checkbox',
      'default'               =>  true
  ) );

  $wp_customize->add_control( new Travel_Tour_Toggle_Control( $wp_customize, 'banner_section_display_option', array(
      'label' => esc_html__( 'Hide / Show','travel-tour' ),
      'section' => 'header_image',
      'settings' => 'banner_section_display_option',
      'type'=> 'toggle',
      'priority'  =>  1
  ) ) );

  $wp_customize->add_setting( 'banner_section_title', array(
      'sanitize_callback'     =>  'sanitize_text_field',
      'default'               =>  ''
  ) );

  $wp_customize->add_control( 'banner_section_title', array(
      'label' => esc_html__( 'Banner Title','travel-tour' ),
      'section' => 'header_image',
      'settings' => 'banner_section_title',
      'type'=> 'text',
      'priority'  =>  2
  ) );

  $wp_customize->selective_refresh->add_partial( 'banner_section_title', array(
      'selector' => '.banner-title',
  ) );

  $wp_customize->add_setting( 'banner_section_description', array(
      'sanitize_callback'     =>  'sanitize_text_field',
      'default'               =>  ''
  ) );

  $wp_customize->add_control( 'banner_section_description', array(
      'label' => esc_html__( 'Description','travel-tour' ),
      'section' => 'header_image',
      'settings' => 'banner_section_description',
      'type'=> 'text',
      'priority'  =>  3
  ) );

  $wp_customize->selective_refresh->add_partial( 'banner_section_description', array(
      'selector' => '.banner-desc',
  ) );

  $wp_customize->add_setting( 'banner_section_cta_label', array(
      'transport' => 'postMessage',
      'sanitize_callback'     =>  'sanitize_text_field',
      'default'               =>  ''
  ) );

  $wp_customize->add_control( 'banner_section_cta_label', array(
      'label' => esc_html__( 'CTA Label','travel-tour' ),
      'section' => 'header_image',
      'settings' => 'banner_section_cta_label',
      'type'=> 'text',
      'priority'  =>  4
  ) );

  $wp_customize->add_setting( 'banner_section_cta_link', array(
      'sanitize_callback'     =>  'esc_url_raw',
      'default'               =>  ''
  ) );

  $wp_customize->add_control( 'banner_section_cta_link', array(
      'label' => esc_html__( 'CTA Link','travel-tour' ),
      'section' => 'header_image',
      'settings' => 'banner_section_cta_link',
      'type'=> 'url',
      'priority'  =>  5
  ) );

  $wp_customize->selective_refresh->add_partial( 'banner_section_cta_label', array(
      'selector' => '.banner-btn',
  ) );

  $wp_customize->add_setting( 'search_section_display_option', array(
      'sanitize_callback'     =>  'travel_tour_sanitize_checkbox',
      'default'               =>  true
  ) );

  $wp_customize->add_control( new Travel_Tour_Toggle_Control( $wp_customize, 'search_section_display_option', array(
      'label' => esc_html__( 'Hide / Show search field', 'travel-tour' ),
      'section' => 'header_image',
      'settings' => 'search_section_display_option',
      'type'=> 'toggle',
      'priority'  =>  6
  ) ) );

  $wp_customize->selective_refresh->add_partial( 'search_section_display_option', array(
      'selector' => '.banner-search',
  ) );

}