<?php
/**
 * Banner Section Settings
 *
 * @package restaurant_brunch
 */

// Add Banner Section
$wp_customize->add_section(
	'restaurant_brunch_banner_section',
	array(
		'panel'    => 'restaurant_brunch_front_page_options',
		'title'    => esc_html__( 'Banner Section', 'restaurant-brunch' ),
		'priority' => 10,
	)
);

// Enable Banner Section
$wp_customize->add_setting(
	'restaurant_brunch_enable_banner_section',
	array(
		'default'           => false,
		'sanitize_callback' => 'restaurant_brunch_sanitize_switch',
	)
);

$wp_customize->add_control(
	new Restaurant_Brunch_Toggle_Switch_Custom_Control(
		$wp_customize,
		'restaurant_brunch_enable_banner_section',
		array(
			'label'    => esc_html__( 'Enable Banner Section', 'restaurant-brunch' ),
			'section'  => 'restaurant_brunch_banner_section',
			'settings' => 'restaurant_brunch_enable_banner_section',
		)
	)
);

// Add Separator Custom Control
$wp_customize->add_setting( 'restaurant_brunch_banner_separators', array(
	'sanitize_callback' => 'sanitize_text_field',
) );

$wp_customize->add_control( new Restaurant_Brunch_Separator_Custom_Control( $wp_customize, 'restaurant_brunch_banner_separators', array(
	'label' => __( 'Select Banner Category', 'restaurant-brunch' ),
	'section' => 'restaurant_brunch_banner_section',
	'settings' => 'restaurant_brunch_banner_separators',
	'active_callback' => 'restaurant_brunch_is_banner_slider_section_enabled',
)));

// Banner Category Setting
$wp_customize->add_setting(
	'restaurant_brunch_banner_slider_category',
	array(
		'default'           => 'slider',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	new Restaurant_Brunch_Customize_Category_Dropdown_Control(
		$wp_customize,
		'restaurant_brunch_banner_slider_category',
		array(
			'label'    => __( 'Select Banner Category', 'restaurant-brunch' ),
			'section'  => 'restaurant_brunch_banner_section',
			'settings' => 'restaurant_brunch_banner_slider_category',
			'active_callback' => 'restaurant_brunch_is_banner_slider_section_enabled',
		)
	)
);

// Button Label
$wp_customize->add_setting(
	'restaurant_brunch_banner_button_label',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'restaurant_brunch_banner_button_label',
	array(
		'label'           => esc_html__( 'Button Label', 'restaurant-brunch'  ),
		'section'         => 'restaurant_brunch_banner_section',
		'settings'        => 'restaurant_brunch_banner_button_label',
		'type'            => 'text',
		'active_callback' => 'restaurant_brunch_is_banner_slider_section_enabled',
	)
);

// Button Link
$wp_customize->add_setting(
	'restaurant_brunch_banner_button_link',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'restaurant_brunch_banner_button_link',
	array(
		'label'           => esc_html__( 'Button Link', 'restaurant-brunch' ),
		'section'         => 'restaurant_brunch_banner_section',
		'settings'        => 'restaurant_brunch_banner_button_link',
		'type'            => 'url',
		'active_callback' => 'restaurant_brunch_is_banner_slider_section_enabled',
	)
);

// Banner Button Label Color
$wp_customize->add_setting(
	'restaurant_brunch_banner_btn_color',
	array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize,'restaurant_brunch_banner_btn_color',array(
			'label' => __('Banner Button Label Color','restaurant-brunch'),
			'section' => 'restaurant_brunch_banner_section',
			'settings' => 'restaurant_brunch_banner_btn_color',
			'active_callback' => 'restaurant_brunch_is_banner_slider_section_enabled',
		)
	)
);

// Banner Button Background Color
$wp_customize->add_setting('restaurant_brunch_banner_btn_bg_color',array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize,'restaurant_brunch_banner_btn_bg_color',array(
			'label' => __('Banner Button Background Color','restaurant-brunch'),
			'section' => 'restaurant_brunch_banner_section',
			'settings' => 'restaurant_brunch_banner_btn_bg_color',
			'active_callback' => 'restaurant_brunch_is_banner_slider_section_enabled',
		)
	)
);

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

$wp_customize->add_control(
	'restaurant_brunch_banner_settings_upgraded_features', 
	array(
		'type'=> 'hidden',
		'description' => "
			<div class='customizer-upgraded-features'>
				<i class='fas fa-info-circle'></i>
				<span class='pro-text'>
					Unlock Premium <strong>Features</strong> ?<br>
					<a target='_blank' href='". esc_url(RESTAURANT_BRUNCH_PREMIUM_PAGE) ." '>Upgrade Pro</a>
				</div>
			</div>
		",
		'section' => 'restaurant_brunch_banner_section'
	)
);