function form($instance)
        {
            global $woocommerce;
            $defaults = array('title' => '', 'attribute' => '', 'query_type' => 'and', 'type' => 'list', 'colors' => '', 'multicolor' => array(), 'labels' => '', 'display' => 'all');
            $instance = wp_parse_args((array) $instance, $defaults);
            $widget_types = apply_filters('yith_wcan_widget_types', array('list' => __('List', 'yith-woocommerce-ajax-navigation'), 'color' => __('Color', 'yith-woocommerce-ajax-navigation'), 'label' => __('Label', 'yith-woocommerce-ajax-navigation'), 'select' => __('Dropdown', 'yith-woocommerce-ajax-navigation')));
            ?>

            <p>
                <label>
                    <strong><?php 
            _e('Title', 'yith-woocommerce-ajax-navigation');
            ?>
:</strong><br />
                    <input class="widefat" type="text" id="<?php 
            echo $this->get_field_id('title');
            ?>
" name="<?php 
            echo $this->get_field_name('title');
            ?>
" value="<?php 
            echo $instance['title'];
            ?>
" />
                </label>
            </p>

            <p>
                <label for="<?php 
            echo $this->get_field_id('type');
            ?>
"><strong><?php 
            _e('Type:', 'yith-woocommerce-ajax-navigation');
            ?>
</strong></label>
                <select class="yith_wcan_type widefat" id="<?php 
            echo esc_attr($this->get_field_id('type'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('type'));
            ?>
">
                    <?php 
            foreach ($widget_types as $type => $label) {
                ?>
                        <option value="<?php 
                echo $type;
                ?>
" <?php 
                selected($type, $instance['type']);
                ?>
><?php 
                echo $label;
                ?>
</option>
                    <?php 
            }
            ?>
                </select>
            </p>

            <?php 
            do_action('yith_wcan_after_widget_type');
            ?>

            <p>
                <label for="<?php 
            echo $this->get_field_id('query_type');
            ?>
"><?php 
            _e('Query Type:', 'yith-woocommerce-ajax-navigation');
            ?>
</label>
                <select id="<?php 
            echo esc_attr($this->get_field_id('query_type'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('query_type'));
            ?>
">
                    <option value="and" <?php 
            selected($instance['query_type'], 'and');
            ?>
><?php 
            _e('AND', 'yith-woocommerce-ajax-navigation');
            ?>
</option>
                    <option value="or" <?php 
            selected($instance['query_type'], 'or');
            ?>
><?php 
            _e('OR', 'yith-woocommerce-ajax-navigation');
            ?>
</option>
                </select>
            </p>

            <p class="yith-wcan-attribute-list" style="display: <?php 
            echo $instance['type'] == 'tags' || $instance['type'] == 'brands' || $instance['type'] == 'categories' ? 'none' : 'block';
            ?>
;">

                <label for="<?php 
            echo $this->get_field_id('attribute');
            ?>
"><strong><?php 
            _e('Attribute:', 'yith-woocommerce-ajax-navigation');
            ?>
</strong></label>
                <select class="yith_wcan_attributes widefat" id="<?php 
            echo esc_attr($this->get_field_id('attribute'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('attribute'));
            ?>
">
                    <?php 
            yith_wcan_dropdown_attributes($instance['attribute']);
            ?>
                </select>
            </p>

            <p id="yit-wcan-display" class="yit-wcan-display-<?php 
            echo $instance['type'];
            ?>
">
                <label for="<?php 
            echo $this->get_field_id('display');
            ?>
"><strong><?php 
            _e('Display (default All):', 'yith-woocommerce-ajax-navigation');
            ?>
</strong></label>
                <select class="yith_wcan_type widefat" id="<?php 
            echo esc_attr($this->get_field_id('display'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('display'));
            ?>
">
                    <option value="all"          <?php 
            selected('all', $instance['display']);
            ?>
>          <?php 
            _e('All (no hierarchical)', 'yith-woocommerce-ajax-navigation');
            ?>
</option>
                    <option value="hierarchical" <?php 
            selected('hierarchical', $instance['display']);
            ?>
> <?php 
            _e('All (hierarchical)', 'yith-woocommerce-ajax-navigation');
            ?>
   </option>
                    <option value="parent"       <?php 
            selected('parent', $instance['display']);
            ?>
>       <?php 
            _e('Only Parent', 'yith-woocommerce-ajax-navigation');
            ?>
        </option>
                </select>
            </p>

            <div class="yith_wcan_placeholder">
                <?php 
            $values = array();
            if ($instance['type'] == 'color') {
                $values = $instance['colors'];
            }
            if ($instance['type'] == 'multicolor') {
                $values = $instance['multicolor'];
            } elseif ($instance['type'] == 'label') {
                $values = $instance['labels'];
            }
            yith_wcan_attributes_table($instance['type'], $instance['attribute'], 'widget-' . $this->id . '-', 'widget-' . $this->id_base . '[' . $this->number . ']', $values, $instance['display']);
            ?>
            </div>
            <span class="spinner" style="display: none;"></span>

        <input type="hidden" name="widget_id" value="widget-<?php 
            echo $this->id;
            ?>
-" />
        <input type="hidden" name="widget_name" value="widget-<?php 
            echo $this->id_base;
            ?>
[<?php 
            echo $this->number;
            ?>
]" />

            <script>jQuery(document).trigger('yith_colorpicker');</script>
        <?php 
        }
        function form($instance)
        {
            global $woocommerce;
            $defaults = array('title' => '', 'attribute' => '', 'query_type' => 'and', 'type' => 'list', 'colors' => '', 'labels' => '', 'display' => 'all');
            $instance = wp_parse_args((array) $instance, $defaults);
            ?>

    <p>
        <label>
            <strong><?php 
            _e('Title', 'yit');
            ?>
:</strong><br />
            <input class="widefat" type="text" id="<?php 
            echo $this->get_field_id('title');
            ?>
" name="<?php 
            echo $this->get_field_name('title');
            ?>
" value="<?php 
            echo $instance['title'];
            ?>
" />
        </label>
    </p>

    <p>
        <label for="<?php 
            echo $this->get_field_id('attribute');
            ?>
"><strong><?php 
            _e('Attribute:', 'yit');
            ?>
</strong></label>
        <select class="yith_wcan_attributes widefat" id="<?php 
            echo esc_attr($this->get_field_id('attribute'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('attribute'));
            ?>
">
            <?php 
            yith_wcan_dropdown_attributes($instance['attribute']);
            ?>
        </select></p>

    <p><label for="<?php 
            echo $this->get_field_id('query_type');
            ?>
"><?php 
            _e('Query Type:', 'yit');
            ?>
</label>
        <select id="<?php 
            echo esc_attr($this->get_field_id('query_type'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('query_type'));
            ?>
">
            <option value="and" <?php 
            selected($instance['query_type'], 'and');
            ?>
><?php 
            _e('AND', 'yit');
            ?>
</option>
            <option value="or" <?php 
            selected($instance['query_type'], 'or');
            ?>
><?php 
            _e('OR', 'yit');
            ?>
</option>
        </select></p>

    <p><label for="<?php 
            echo $this->get_field_id('type');
            ?>
"><strong><?php 
            _e('Type:', 'yit');
            ?>
</strong></label>
        <select class="yith_wcan_type widefat" id="<?php 
            echo esc_attr($this->get_field_id('type'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('type'));
            ?>
">
            <option value="list" <?php 
            selected('list', $instance['type']);
            ?>
><?php 
            _e('List', 'yit');
            ?>
</option>
            <option value="color" <?php 
            selected('color', $instance['type']);
            ?>
><?php 
            _e('Color', 'yit');
            ?>
</option>
            <option value="label" <?php 
            selected('label', $instance['type']);
            ?>
><?php 
            _e('Label', 'yit');
            ?>
</option>
            <option value="select" <?php 
            selected('select', $instance['type']);
            ?>
><?php 
            _e('Dropdown', 'yit');
            ?>
</option>
        </select>
    </p>

    <p id="yit-wcan-display" class="yit-wcan-display-<?php 
            echo $instance['type'];
            ?>
">
        <label for="<?php 
            echo $this->get_field_id('display');
            ?>
"><strong><?php 
            _e('Display (default All):', 'yit');
            ?>
</strong></label>
        <select class="yith_wcan_type widefat" id="<?php 
            echo esc_attr($this->get_field_id('display'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('display'));
            ?>
">
            <option value="all"          <?php 
            selected('all', $instance['display']);
            ?>
>          <?php 
            _e('All (no hierarchical)', 'yit');
            ?>
</option>
            <option value="hierarchical" <?php 
            selected('hierarchical', $instance['display']);
            ?>
> <?php 
            _e('All Hierarchical', 'yit');
            ?>
   </option>
            <option value="parent"       <?php 
            selected('parent', $instance['display']);
            ?>
>       <?php 
            _e('Only Parent', 'yit');
            ?>
        </option>
        </select>
    </p>

    <div class="yith_wcan_placeholder">
        <?php 
            yith_wcan_attributes_table($instance['type'], $instance['attribute'], 'widget-' . $this->id . '-', 'widget-' . $this->id_base . '[' . $this->number . ']', $instance['type'] == 'color' ? $instance['colors'] : ($instance['type'] == 'label' ? $instance['labels'] : array()), $instance['display']);
            ?>
    </div>
    <span class="spinner" style="display: none;"></span>

<input type="hidden" name="widget_id" value="widget-<?php 
            echo $this->id;
            ?>
-" />
<input type="hidden" name="widget_name" value="widget-<?php 
            echo $this->id_base;
            ?>
[<?php 
            echo $this->number;
            ?>
]" />

    <script>jQuery(document).trigger('yith_colorpicker');</script>
<?php 
        }