<?php
/**
 * Customizer upsell related functions
 *
 * @package Meridian One
 * @since 1.0
 */

/**
 * Table Of Contents
 *
 * meridian_one_customizer_upsell ( Add the custom section to customizer )
 * meridian_one_customizer_upsell_scripts ( Enqueue scripts and styles to Customizer )
 */

// include class for custom control
include get_parent_theme_file_path() . '/inc/customizer-upsell/class.customizer-upsell.php';

if ( ! function_exists( 'meridian_one_customizer_upsell' ) ) {

	/**
	 * Add the custom control to customizer
	 *
	 * @since 1.0
	 */
	function meridian_one_customizer_upsell( $wp_customize ) {

		$wp_customize->add_section( 'meridian_one_upsell_section', array(
			'title' => esc_html__( 'Meridian One Plus', 'meridian-one' ),
			'description' => '',
			'priority' => 1000
		) );

			$wp_customize->add_setting( 'meridian_one_upsell', array(
				'default'	=> '',
				'type'		=> 'theme_mod',
				'sanitize_callback' => 'esc_html',
			) );

				$wp_customize->add_control( new WP_Customize_Meridian_One_Upsell_Control( $wp_customize, 'meridian_one_upsell', array(
					'label'		=> '',
					'section' 	=> 'meridian_one_upsell_section',
					'description' => ''
				) ) );

	}

} add_action( 'customize_register', 'meridian_one_customizer_upsell' );

if ( ! function_exists( 'meridian_one_customizer_upsell_scripts' ) ) {

	/**
	 * Enqueue scripts and styles to Customizer
	 *
	 * @since 1.0
	 */
	function meridian_one_customizer_upsell_scripts() {

		// theme
		$theme = wp_get_theme();

		// styles
		wp_enqueue_style( 'meridian-one-customizer-upsell-css', get_parent_theme_file_uri() . '/inc/customizer-upsell/customizer-upsell.css', array(), $theme->get( 'Version' ) );

	} 

} add_action( 'customize_controls_enqueue_scripts', 'meridian_one_customizer_upsell_scripts' );