<?php
if (!defined('ABSPATH'))
	exit;

/**
 * Frontpage Promo Banner Section.
 *
 * @package pawfect
 */

if (!class_exists('pawfect_Customize_Homepage_Promo_Banner_Option')):

	class pawfect_Customize_Homepage_Promo_Banner_Option extends pawfect_Customize_Base_Option
	{

		public function elements()
		{
			return array(

				'pawfect_promo_banner_heading' => array(
					'setting' => array(),
					'control' => array(
						'type' => 'heading',
						'priority' => 1,
						'label' => esc_html__('Promo Banner Options', 'pawfect'),
						'section' => 'pawfect_promo_banner_section',
					),
				),

				'pawfect_promo_banner_enabled' => array(
					'setting' => array(
						'default' => true,
						'sanitize_callback' => array('pawfect_Customizer_Sanitize', 'sanitize_checkbox'),
					),
					'control' => array(
						'type' => 'toggle',
						'priority' => 2,
						'label' => esc_html__('Enable Promo Banner Section', 'pawfect'),
						'section' => 'pawfect_promo_banner_section',
					),
				),

				'pawfect_promo_banner_title' => array(
					'setting' => array(
						'default' => esc_html__('SAVE UP TO 50%', 'pawfect'),
						'sanitize_callback' => 'sanitize_text_field',
					),
					'control' => array(
						'type' => 'text',
						'priority' => 3,
						'label' => esc_html__('Banner Title', 'pawfect'),
						'section' => 'pawfect_promo_banner_section',
						'active_callback' => 'pawfect_promo_banner_enabled',
					),
				),

				'pawfect_promo_banner_description' => array(
					'setting' => array(
						'default' => esc_html__('Canâ€™t wait to save? Shop our semi-annual sale now.', 'pawfect'),
						'sanitize_callback' => 'sanitize_textarea_field',
					),
					'control' => array(
						'type' => 'textarea',
						'priority' => 4,
						'label' => esc_html__('Banner Description', 'pawfect'),
						'section' => 'pawfect_promo_banner_section',
						'active_callback' => 'pawfect_promo_banner_enabled',
					),
				),

				'pawfect_promo_banner_button_text' => array(
					'setting' => array(
						'default' => esc_html__('SHOP NOW', 'pawfect'),
						'sanitize_callback' => 'sanitize_text_field',
					),
					'control' => array(
						'type' => 'text',
						'priority' => 5,
						'label' => esc_html__('Button Text', 'pawfect'),
						'section' => 'pawfect_promo_banner_section',
						'active_callback' => 'pawfect_promo_banner_enabled',
					),
				),

				'pawfect_promo_banner_button_link' => array(
					'setting' => array(
						'default' => '#',
						'sanitize_callback' => 'esc_url_raw',
					),
					'control' => array(
						'type' => 'url',
						'priority' => 6,
						'label' => esc_html__('Button Link', 'pawfect'),
						'section' => 'pawfect_promo_banner_section',
						'active_callback' => 'pawfect_promo_banner_enabled',
					),
				),

				'pawfect_promo_banner_button_target' => array(
					'setting' => array(
						'default' => '_self',
						'sanitize_callback' => array('pawfect_Customizer_Sanitize', 'sanitize_radio'),
					),
					'control' => array(
						'type' => 'radio-switch',
						'priority' => 7,
						'label' => esc_html__('Button Link Target', 'pawfect'),
						'section' => 'pawfect_promo_banner_section',
						'choices' => array(
							'_self' => esc_html__('Same Tab', 'pawfect'),
							'_blank' => esc_html__('New Tab', 'pawfect'),
						),
						'active_callback' => 'pawfect_promo_banner_enabled',
					),
				),

				'pawfect_promo_banner_title_color' => array(
					'setting' => array(
						'default' => '#1f2937',
						'sanitize_callback' => array('pawfect_Customizer_Sanitize', 'sanitize_alpha_color'),
					),
					'control' => array(
						'type' => 'color',
						'priority' => 8,
						'label' => esc_html__('Title Color', 'pawfect'),
						'section' => 'pawfect_promo_banner_section',
						'active_callback' => 'pawfect_promo_banner_enabled',
					),
				),

				'pawfect_promo_banner_subtitle_color' => array(
					'setting' => array(
						'default' => '#F4A259',
						'sanitize_callback' => array('pawfect_Customizer_Sanitize', 'sanitize_alpha_color'),
					),
					'control' => array(
						'type' => 'color',
						'priority' => 9,
						'label' => esc_html__('Subtitle Color', 'pawfect'),
						'section' => 'pawfect_promo_banner_section',
						'active_callback' => 'pawfect_promo_banner_enabled',
					),
				),

				'pawfect_promo_banner_image' => array(
					'setting' => array(
						'default' => PAWFECT_THEME_URL . '/assets/images/shop-now3.webp',
						'sanitize_callback' => 'esc_url_raw',
					),
					'control' => array(
						'type' => 'image',
						'priority' => 10,
						'label' => esc_html__('Background Image', 'pawfect'),
						'section' => 'pawfect_promo_banner_section',
						'active_callback' => 'pawfect_promo_banner_enabled',
					),
				),

				'pawfect_promo_banner_container' => array(
					'setting' => array(
						'default' => 'pawfect-container',
						'sanitize_callback' => array( 'pawfect_Customizer_Sanitize', 'sanitize_radio' ),
					),
					'control' => array(
						'type' => 'radio-switch',
						'priority' => 11,
						'label' => esc_html__('Container Width', 'pawfect'),
						'section' => 'pawfect_promo_banner_section',
						'choices' => array(
							'pawfect-container-small' => esc_html__( 'Small Container', 'pawfect' ),
							'pawfect-container' => esc_html__( 'Standard Container', 'pawfect' ),
							'pawfect-container-full' => esc_html__( 'Full Width Container', 'pawfect' ),
						),
						'active_callback' => 'pawfect_promo_banner_enabled',
					),
				),

				'pawfect_promo_banner_background_color' => array(
					'setting' => array(
						'default' => '#fef9f5',
						'sanitize_callback' => 'sanitize_hex_color',
					),
					'control' => array(
						'type' => 'color',
						'priority' => 9,
						'label' => esc_html__('Background Color (optional)', 'pawfect'),
						'section' => 'pawfect_promo_banner_section',
						'active_callback' => 'pawfect_promo_banner_enabled',
					),
				),

			);
		}
	}

	new pawfect_Customize_Homepage_Promo_Banner_Option();

endif;
function pawfect_promo_banner_enabled($control)
{
	return get_theme_mod('pawfect_promo_banner_enabled', true) === true;
}


