WC_Widget_Brand_Thumbnails::update()publicWC 1.0

Update widget instance.

Метод класса: WC_Widget_Brand_Thumbnails{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WC_Widget_Brand_Thumbnails = new WC_Widget_Brand_Thumbnails();
$WC_Widget_Brand_Thumbnails->update( $new_instance, $old_instance );
$new_instance(массив) (обязательный)
The new settings for the particular instance of the widget.
$old_instance(массив) (обязательный)
The old settings for the particular instance of the widget.

Заметки

  • Смотрите: WP_Widget->update

Код WC_Widget_Brand_Thumbnails::update() WC 9.4.2

public function update( $new_instance, $old_instance ) {
	$instance['title']         = wp_strip_all_tags( stripslashes( $new_instance['title'] ) );
	$instance['columns']       = wp_strip_all_tags( stripslashes( $new_instance['columns'] ) );
	$instance['fluid_columns'] = ! empty( $new_instance['fluid_columns'] ) ? true : false;
	$instance['orderby']       = wp_strip_all_tags( stripslashes( $new_instance['orderby'] ) );
	$instance['exclude']       = wp_strip_all_tags( stripslashes( $new_instance['exclude'] ) );
	$instance['hide_empty']    = wp_strip_all_tags( stripslashes( (string) $new_instance['hide_empty'] ) );
	$instance['number']        = wp_strip_all_tags( stripslashes( $new_instance['number'] ) );

	if ( ! $instance['columns'] ) {
		$instance['columns'] = 1;
	}

	if ( ! $instance['orderby'] ) {
		$instance['orderby'] = 'name';
	}

	if ( ! $instance['exclude'] ) {
		$instance['exclude'] = '';
	}

	if ( ! $instance['hide_empty'] ) {
		$instance['hide_empty'] = 0;
	}

	if ( ! $instance['number'] ) {
		$instance['number'] = '';
	}

	return $instance;
}