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

update


Description Description

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


Top ↑

Parameters Parameters

$new_instance

(array) (Required)

$old_instance

(array) (Required)


Top ↑

Return Return

(array) The updated array full of settings


Top ↑

Source Source

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

	public function update( $new_instance, $old_instance ) {

		$instance = array();
		$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
		$instance['columns'] = ( ! empty( $new_instance['columns'] ) ) ? strip_tags( $new_instance['columns'] ) : 5;
		$instance['limit'] = ( ! empty( $new_instance['limit'] ) ) ? strip_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'] ) ) ? $new_instance['newest_first'] == 'true' : false;
		return $instance;
	}