Inventory_Presser_KBB_Widget::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/widget/class-widget-kbb.php

	public function update( $new_instance, $old_instance ) {
		$image_keys               = array_keys( $this->images() );
		$instance                 = array();
		$instance['title']        = ( ! empty( $new_instance['title'] ) ) ? wp_strip_all_tags( $new_instance['title'] ) : '';
		$instance['before_image'] = ( ! empty( $new_instance['before_image'] ) ) ? wp_strip_all_tags( $new_instance['before_image'] ) : '';
		$instance['image']        = ( ! empty( $new_instance['image'] ) ) ? wp_strip_all_tags( $new_instance['image'] ) : $image_keys[0];
		$instance['after_image']  = ( ! empty( $new_instance['after_image'] ) ) ? wp_strip_all_tags( $new_instance['after_image'] ) : '';
		return $instance;
	}