<?php

/**
 * About Section
 *
 * @package florist_bouquet
 */

	$wp_customize->add_section(
		'florist_bouquet_about_section',
		array(
			'panel'    => 'florist_bouquet_front_page_options',
			'title'    => esc_html__( 'About Section', 'florist-bouquet' ),
			'priority' => 10,
		)
	);

	// About Section - Enable Section.
	$wp_customize->add_setting(
		'florist_bouquet_enable_about_section',
		array(
			'default'           => false,
			'sanitize_callback' => 'florist_bouquet_sanitize_switch',
		)
	);

	$wp_customize->add_control(
		new Florist_Bouquet_Toggle_Switch_Custom_Control(
			$wp_customize,
			'florist_bouquet_enable_about_section',
			array(
				'label'    => esc_html__( 'Enable About Section', 'florist-bouquet' ),
				'section'  => 'florist_bouquet_about_section',
				'settings' => 'florist_bouquet_enable_about_section',
			)
		)
	);

	if ( isset( $wp_customize->selective_refresh ) ) {
		$wp_customize->selective_refresh->add_partial(
			'florist_bouquet_enable_about_section',
			array(
				'selector' => '#florist_bouquet_about_section .section-link',
				'settings' => 'florist_bouquet_enable_about_section',
			)
		);
	}

	// About Section - About Content Type.
	$wp_customize->add_setting(
		'florist_bouquet_about_content_type',
		array(
			'default'           => 'post',
			'sanitize_callback' => 'florist_bouquet_sanitize_select',
		)
	);

	$wp_customize->add_control(
		'florist_bouquet_about_content_type',
		array(
			'label'           => esc_html__( 'Select About Content Type', 'florist-bouquet' ),
			'section'         => 'florist_bouquet_about_section',
			'settings'        => 'florist_bouquet_about_content_type',
			'type'            => 'select',
			'active_callback' => 'florist_bouquet_is_about_section_enabled',
			'choices'         => array(
				'page' => esc_html__( 'Page', 'florist-bouquet' ),
				'post' => esc_html__( 'Post', 'florist-bouquet' ),
			),
		)
	);

	// Services Category Setting.
	$wp_customize->add_setting('florist_bouquet_about_category', array(
		'default'           => 'about',
		'sanitize_callback' => 'sanitize_text_field',
	));

	// Add custom control for Services Category with conditional visibility.
	$wp_customize->add_control(new WP_Customize_Category_Dropdown_Control($wp_customize, 'florist_bouquet_about_category', array(
		'label'    => __('Select Services Category', 'florist-bouquet'),
		'section'  => 'florist_bouquet_about_section',
		'settings' => 'florist_bouquet_about_category',
		'active_callback' => function() use ($wp_customize) {
			return $wp_customize->get_setting('florist_bouquet_about_content_type')->value() === 'post';
		},
	)));

	// Service Section - Select Post.
	$wp_customize->add_setting(
		'florist_bouquet_about_content_post_',
		array(
			'sanitize_callback' => 'absint',
		)
	);

	$wp_customize->add_control(
		'florist_bouquet_about_content_post_',
		array(
			'label'           => esc_html__( 'Select Post ', 'florist-bouquet' ),
			'description'     => sprintf( esc_html__( 'Kindly :- Select a Post based on the category selected in the upper settings', 'florist-bouquet' ), ),
			'section'         => 'florist_bouquet_about_section',
			'settings'        => 'florist_bouquet_about_content_post_',
			'active_callback' => 'florist_bouquet_is_about_section_and_content_type_post_enabled',
			'type'            => 'select',
			'choices'         => florist_bouquet_get_post_choices(),
		)
	);
	// About Section - Select About Page.
	$wp_customize->add_setting(
		'florist_bouquet_about_content_page_',
		array(
			'sanitize_callback' => 'absint',
		)
	);

	$wp_customize->add_control(
		'florist_bouquet_about_content_page_',
		array(
			'label'           => esc_html__( 'Select Page', 'florist-bouquet' ),
			'section'         => 'florist_bouquet_about_section',
			'settings'        => 'florist_bouquet_about_content_page_',
			'active_callback' => 'florist_bouquet_is_about_section_and_content_type_page_enabled',
			'type'            => 'select',
			'choices'         => florist_bouquet_get_page_choices(),
		)
	);

	// About Section - Button Label.
	$wp_customize->add_setting(
		'florist_bouquet_about_button_label_',
		array(
			'default'           => '',
			'sanitize_callback' => 'sanitize_text_field',
		)
	);

	$wp_customize->add_control(
		'florist_bouquet_about_button_label_',
		array(
			'label'           => esc_html__( 'Button Label', 'florist-bouquet' ),
			'section'         => 'florist_bouquet_about_section',
			'settings'        => 'florist_bouquet_about_button_label_',
			'type'            => 'text',
			'active_callback' => 'florist_bouquet_is_about_section_enabled',
		)
	);

	// About Section - Button Link.
	$wp_customize->add_setting(
		'florist_bouquet_about_button_link_',
		array(
			'default'           => '',
			'sanitize_callback' => 'esc_url_raw',
		)
	);

	$wp_customize->add_control(
		'florist_bouquet_about_button_link_',
		array(
			'label'           => esc_html__( 'Button Link', 'florist-bouquet' ),
			'section'         => 'florist_bouquet_about_section',
			'settings'        => 'florist_bouquet_about_button_link_',
			'type'            => 'url',
			'active_callback' => 'florist_bouquet_is_about_section_enabled',
		)
	);
$wp_customize->add_setting('custom_image_setting_1', array(
    'default'           => '',
    'transport'         => 'refresh',
    'sanitize_callback' => 'sanitize_text_field', // Sanitization callback function
));

// Image control 1
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'custom_image_setting_control_1', array(
    'label'    => __('Custom Image 1', 'florist-bouquet'),
    'section'  => 'florist_bouquet_about_section',
    'settings' => 'custom_image_setting_1',
	'active_callback' => 'florist_bouquet_is_about_section_enabled',
)));

// Image setting 2
$wp_customize->add_setting('custom_image_setting_2', array(
    'default'           => '',
    'transport'         => 'refresh',
    'sanitize_callback' => 'esc_url_raw', // Sanitization callback function
));
// Image control 2
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'custom_image_setting_control_2', array(
    'label'    => __('Custom Image 2', 'florist-bouquet'),
    'section'  => 'florist_bouquet_about_section',
    'settings' => 'custom_image_setting_2',
	'active_callback' => 'florist_bouquet_is_about_section_enabled',
)));

// Image setting 3
$wp_customize->add_setting('custom_image_setting_3', array(
    'default'           => '',
    'transport'         => 'refresh',
    'sanitize_callback' => 'esc_url_raw', // Sanitization callback function
));

// Image control 3
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'custom_image_setting_control_3', array(
    'label'    => __('Custom Image 3', 'florist-bouquet'),
    'section'  => 'florist_bouquet_about_section',
    'settings' => 'custom_image_setting_3',
	'active_callback' => 'florist_bouquet_is_about_section_enabled',
)));


$wp_customize->add_setting('custom_image_setting_4', array(
    'default'           => '',
    'transport'         => 'refresh',
    'sanitize_callback' => 'esc_url_raw', // Sanitization callback function
));

$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'custom_image_setting_4_control', array(
    'label' => __('Custom Image 4', 'florist-bouquet'),
    'section' => 'florist_bouquet_about_section',
    'settings' => 'custom_image_setting_4',
	'active_callback' => 'florist_bouquet_is_about_section_enabled',
)));