<?php

/*
Widget Name: Staff Grid Widget
Description: A widget to show staff grid view.
Author: imithemes
Author URI: http://imithemes.com
*/

class Staff_Grid_Widget extends SiteOrigin_Widget {
	function __construct() {

		parent::__construct(
			'staff-grid-widget',
			__('Staff Grid Widget', 'imic-framework'),
			array(
				'description' => __('A widget to show staff grid view.', 'imic-framework'),
				'panels_icon' => 'dashicons dashicons-grid-view',
				'panels_groups' => array('framework')
			),
			array(

			),
			array(
				'title' => array(
					'type' => 'text',
					'label' => __('Title', 'siteorigin-widgets'),
				),

				'categories' => array(
					'type' => 'text',
					'label' => __('Categories (Enter comma separated staff categories slugs to filter.)', 'imic-framework'),
				),
				'number_of_posts' => array(
					'type' => 'slider',
					'label' => __( 'Number of staff posts to show', 'imic-framework' ),
					'default' => 3,
					'min' => 1,
					'max' => 50,
					'integer' => true,
				),
				'link_image_title' => array(
					'type' => 'checkbox',
					'default' => true,
					'label' => __('Link image and title of the staff posts?', 'imic-framework'),
				),
				'link_type' => array(
					'type' => 'select',
					'state_name' => 'Modal Box',
					'prompt' => __( 'Link Type', 'imic-framework' ),
					'options' => array(
						'modal' => __( 'Modal Box', 'imic-framework' ),
						'permalink' => __( 'Single Page', 'imic-framework' ),
					), 
					'default' => 'modal'
				),
				'link_image_lightbox' => array(
					'type' => 'checkbox',
					'default' => false,
					'label' => __('Link image of the staff posts to Lightbox?', 'imic-framework'),
				),
				'show_post_meta' => array(
					'type' => 'checkbox',
					'default' => true,
					'label' => __('Show staff position?', 'imic-framework'),
				),
				'excerpt_length' => array(
					'type' => 'text',
					'default' => 20,
					'label' => __('Length of excerpt(Enter the number of words to show)? Leave blank to hide - Default is: 50', 'imic-framework'),
				),
				'strip_html' => array(
					'type' => 'checkbox',
					'default' => true,
					'label' => __('Strip HTML from the excerpt.', 'imic-framework'),
				),
				'read_more_text' => array(
					'type' => 'text',
					'default' => '',
					'label' => __('Read more button text, Leave blank to hide button', 'imic-framework'),
				),
				'column' => array(
					'type' => 'select',
					'state_name' => 'Three',
					'prompt' => __( 'Choose Grid Column', 'imic-framework' ),
					'options' => array(
						'12' => __( 'One', 'imic-framework' ),
						'6' => __( 'Two', 'imic-framework' ),
						'4' => __( 'Three', 'imic-framework' ),
						'3' => __( 'Four', 'imic-framework' ),
						'2' => __( 'Six', 'imic-framework' ),
					),
					'default' => '4'
				),
				'compact_style' => array(
					'type' => 'checkbox',
					'default' => false,
					'label' => __('Compact style grid', 'imic-framework'),
				),
				'order_by' => array(
					'type' => 'select',
					'state_name' => 'Menu Order',
					'prompt' => __( 'Order By', 'imic-framework' ),
					'options' => array(
						'menu_order' => __( 'Menu Order', 'imic-framework' ),
						'id' => __( 'ID', 'imic-framework' ),
					), 
					'default' => 'menu_order'
				),
				'order' => array(
					'type' => 'select',
					'state_name' => 'ASC',
					'prompt' => __( 'Order', 'imic-framework' ),
					'options' => array(
						'ASC' => __( 'Ascending', 'imic-framework' ),
						'DESC' => __( 'Descending', 'imic-framework' ),
					),
					'default' => 'ASC'
				),
			),
			plugin_dir_path(__FILE__)
		);
	}


	
	function get_template_variables( $instance, $args ) {
		$layout = $instance['listing_layout'];
		return array(
				'layout_type' => array(
					'column'  => (!empty($layout['grid_column']))? $layout['grid_column'] : 4
				)
			);
	}
	
	function get_template_name( $instance ) {
		return 'template';
	}

	function get_style_name($instance) {
		return false;
	}

	function get_less_variables($instance){
		return array();
	}
	function modify_instance($instance){
		return $instance;
	}


}

siteorigin_widget_register('staff-grid-widget', __FILE__, 'Staff_Grid_Widget');