<?php
/**
 * This class manage filter form widget.
 *
 * @since 1.1 
 * @package SiteEase_Smart_Product_Filtering_Engine
 * @subpackage SiteEase_Smart_Product_Filtering_Engine/public 
 */

// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class IFQPF_SiteEase_Smart_Product_Filtering_Engine_Form_widget extends WP_Widget {
 	
 	/**
	 * Initialize the class and set its properties.
	 *
	 * @since 1.1
	 */
	public function __construct() {

		parent::__construct(
		// Base ID of your widget
		'ifqpf_form', 
		// Widget name will appear in UI
		esc_html__('Ifqpf Form Widget', 'siteease-smart-product-filtering-engine'), 
		// Widget description
		array( 'description' => esc_html__( 'SiteEase Smart AJAX Product Filter', 'siteease-smart-product-filtering-engine' ), )
		);

	}
 
	/**
	 * Create widget front part
	 *
	 * @since 1.1
	 */
	public function widget( $args, $instance ) {
		global $ifqpf_public;
		$position = ifqpf_get_option('display_filter_position', true);
		$is_load_this = $ifqpf_public->ifqpf_enqueue_conditions();
		?>
		<?php if ( $is_load_this && $position !== 'from_hook' ) { ?>
			<?php echo esc_html($args['before_widget']); ?>
				<div class="ifqpf-widget ifqpf-widget-form">
					<?php $ifqpf_public->ifqpf_render_filter_form(); ?>
				</div>
			<?php echo esc_html($args['after_widget']); ?>
		<?php } ?>
		<?php
	}	

}