'jigoshop_product_search',
'description' => __( 'A search form for your products', 'jigoshop' )
);
// Create the widget
parent::__construct('jigoshop_product_search', __('Jigoshop: Product Search', 'jigoshop'), $options);
}
/**
* Widget
*
* Display the widget in the sidebar
*
* @param array sidebar arguments
* @param array instance
*/
public function widget( $args, $instance ) {
// Extract the widget arguments
extract( $args );
// Set the widget title
$title = apply_filters(
'widget_title',
( $instance['title'] ) ? $instance['title'] : __( 'Product Search', 'jigoshop' ),
$instance,
$this->id_base
);
// Print the widget wrapper & title
echo $before_widget;
echo $before_title . $title . $after_title;
// Construct the form
$form = '';
// Apply a filter to allow for additional fields
echo apply_filters('jigoshop_product_search_form', $form, $instance, $this->id_base);
// Print closing widget wrapper
echo $after_widget;
}
/**
* Update
*
* Handles the processing of information entered in the wordpress admin
*
* @param array new instance
* @param array old instance
* @return array instance
*/
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
// Save the new values
$instance['title'] = strip_tags($new_instance['title']);
return $instance;
}
/**
* Form
*
* Displays the form for the wordpress admin
*
* @param array instance
*/
public function form( $instance ) {
// Get instance data
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : null;
// Widget title
echo "
";
}
} // Jigoshop_Widget_Product_Search