<?php

/**
 * Recommended Trips Settings
 *
 * @package Travel Tour
 */
if ( class_exists( 'Wp_Travel_Engine' ) ) {
    add_action( 'customize_register', 'travel_tour_customize_register_recommended_activities_section' );
}
function travel_tour_customize_register_recommended_activities_section(  $wp_customize  ) {
    $wp_customize->add_section( 'travel_tour_recommended_activities_sections', array(
        'title'       => esc_html__( 'Slider Section', 'travel-tour' ),
        'description' => esc_html__( 'Choose your content to be displayed iin the slider :', 'travel-tour' ),
        'panel'       => 'travel_tour_homepage_panel',
        'priority'    => 4,
    ) );
    $wp_customize->add_setting( 'recommended_activities_display_option', array(
        'sanitize_callback' => 'travel_tour_sanitize_checkbox',
        'default'           => true,
    ) );
    $wp_customize->add_control( new Travel_Tour_Toggle_Control($wp_customize, 'recommended_activities_display_option', array(
        'label'    => esc_html__( 'Hide / Show', 'travel-tour' ),
        'section'  => 'travel_tour_recommended_activities_sections',
        'settings' => 'recommended_activities_display_option',
        'type'     => 'toggle',
    )) );
    $wp_customize->selective_refresh->add_partial( 'recommended_activities_display_option', array(
        'selector' => '.trip-category .slider-section',
    ) );
    $wp_customize->add_setting( 'recommended_activities_category', array(
        'capability'        => 'edit_theme_options',
        'sanitize_callback' => 'sanitize_text_field',
        'default'           => 'activities',
    ) );
    $wp_customize->add_control( new Travel_Tour_Dropdown_Posttype_Taxonomies($wp_customize, 'recommended_activities_category', array(
        'label'    => esc_html__( 'Choose category', 'travel-tour' ),
        'section'  => 'travel_tour_recommended_activities_sections',
        'settings' => 'recommended_activities_category',
        'type'     => 'posttype-taxonomies',
        'posttype' => 'trip',
    )) );
    $wp_customize->add_setting( 'recommended_activities_title', array(
        'sanitize_callback' => 'sanitize_text_field',
        'default'           => '',
    ) );
    $wp_customize->add_control( 'recommended_activities_title', array(
        'label'    => esc_html__( 'Title', 'travel-tour' ),
        'section'  => 'travel_tour_recommended_activities_sections',
        'settings' => 'recommended_activities_title',
        'type'     => 'text',
    ) );
    $wp_customize->add_setting( 'number_of_recommended_activities', array(
        'sanitize_callback' => 'sanitize_text_field',
        'default'           => 4,
    ) );
    $wp_customize->add_control( 'number_of_recommended_activities', array(
        'label'       => esc_html__( 'Number of posts', 'travel-tour' ),
        'section'     => 'travel_tour_recommended_activities_sections',
        'settings'    => 'number_of_recommended_activities',
        'type'        => 'text',
        'description' => 'put -1 for unlimited',
    ) );
    if ( fs_travel_tour()->is_free_plan() ) {
        $wp_customize->add_setting( 'travel_tour_slider_section_upgrade_to_pro', array(
            'sanitize_callback' => null,
        ) );
        $wp_customize->add_control( new Travel_Tour_Control_Upgrade_To_Pro($wp_customize, 'travel_tour_slider_section_upgrade_to_pro', array(
            'section'     => 'travel_tour_recommended_activities_sections',
            'settings'    => 'travel_tour_slider_section_upgrade_to_pro',
            'title'       => __( 'Choose the styling of your slider.', 'travel-tour' ),
            'items'       => array(
                'one' => array(
                    'title' => __( 'Select from three beautiful slider layouts.', 'travel-tour' ),
                ),
            ),
            'button_url'  => esc_url( 'https://thebootstrapthemes.com/travel-tour/#free-vs-pro' ),
            'button_text' => __( 'Upgrade Now', 'travel-tour' ),
        )) );
    }
}
