Inventory_Presser_Grid::update( array $new_instance, array $old_instance )

Saves the widget settings when a dashboard user clicks the Save button.

On This Page


Parameters Parameters

$new_instance

(array) (Required) The new widget options sent from the form.

$old_instance

(array) (Required) The old, saved widget options.


Top ↑

Return Return

(array) The updated array full of settings


Top ↑

Source Source

File: includes/widget/class-widget-inventory-grid.php

	public function update( $new_instance, $old_instance ) {

		$instance                     = array();
		$instance['title']            = ( ! empty( $new_instance['title'] ) ) ? wp_strip_all_tags( $new_instance['title'] ) : '';
		$instance['columns']          = ( ! empty( $new_instance['columns'] ) ) ? wp_strip_all_tags( $new_instance['columns'] ) : 5;
		$instance['limit']            = ( ! empty( $new_instance['limit'] ) ) ? wp_strip_all_tags( $new_instance['limit'] ) : 15;
		$instance['cb_showcaptions']  = ( ! empty( $new_instance['cb_showcaptions'] ) ) ? $new_instance['cb_showcaptions'] : '';
		$instance['cb_showprices']    = ( ! empty( $new_instance['cb_showprices'] ) ) ? $new_instance['cb_showprices'] : '';
		$instance['cb_showbutton']    = ( ! empty( $new_instance['cb_showbutton'] ) ) ? $new_instance['cb_showbutton'] : '';
		$instance['cb_featured_only'] = ( ! empty( $new_instance['cb_featured_only'] ) ) ? $new_instance['cb_featured_only'] : '';
		$instance['newest_first']     = ! empty( $new_instance['newest_first'] );
		return $instance;
	}