<?php

/*
Widget Name: Featured Block Widget
Description: A widget to show featured block to redirect users to some page.
Author: imithemes
Author URI: http://imithemes.com
*/

class Featured_Block_Widget extends SiteOrigin_Widget {
	function __construct() {

		parent::__construct(
			'featured-block-widget',
			__('Featured Block Widget', 'imic-framework'),
			array(
				'description' => __('A widget to show featured block to redirect users to some page.', 'imic-framework'),
				'panels_icon' => 'dashicons dashicons-star-filled',
				'panels_groups' => array('framework')
			),
			array(

			),
			array(
				'featured_image' => array(
					'type' => 'media',
					'label' => __('Image file', 'siteorigin-widgets'),
					'library' => 'image',
					'fallback' => true,
				),

				'featured_size' => array(
					'type' => 'select',
					'label' => __('Image size', 'siteorigin-widgets'),
					'options' => array(
						'full' => __('Full', 'siteorigin-widgets'),
						'large' => __('Large', 'siteorigin-widgets'),
						'medium' => __('Medium', 'siteorigin-widgets'),
						'thumb' => __('Thumbnail', 'siteorigin-widgets'),
					),
				),

				'featured_title' => array(
					'type' => 'text',
					'label' => __('Title text', 'siteorigin-widgets'),
				),
				'featured_text' => array(
					'type' => 'textarea',
					'label' => __('Featured Box Text', 'siteorigin-widgets'),
				),

				'featured_url' => array(
					'type' => 'link',
					'label' => __('Destination URL', 'siteorigin-widgets'),
				),
				'featured_new_window' => array(
					'type' => 'checkbox',
					'default' => false,
					'label' => __('Open in new window', 'siteorigin-widgets'),
				),
				'hover_effect' => array(
					'type' => 'checkbox',
					'default' => false,
					'label' => __('Hover Effect on Images', 'framework'),
				),

				'featured_bound' => array(
					'type' => 'checkbox',
					'default' => true,
					'label' => __('Bound', 'siteorigin-widgets'),
					'description' => __("Make sure the image doesn't extend beyond its container.", 'siteorigin-widgets'),
				),
				'featured_full_width' => array(
					'type' => 'checkbox',
					'default' => false,
					'label' => __('Full Width', 'siteorigin-widgets'),
					'description' => __("Resize image to fit its container.", 'siteorigin-widgets'),
				),

			),
			plugin_dir_path(__FILE__)
		);
	}


	function get_style_hash($instance) {
		return substr( md5( serialize( $this->get_less_variables( $instance ) ) ), 0, 12 );
	}

	function get_style_name($instance) {
		return false;
	}

	function get_less_variables($instance){
		return array();
	}
	
	function get_template_name($instance) {
		return 'featured-block-widget-template';
	}


}

siteorigin_widget_register('featured-block-widget', __FILE__, 'Featured_Block_Widget');