W3cubDocs

/WordPress

WP_Customize_Widgets::sanitize_widget_js_instance( array $value )

Converts a widget instance into JSON-representable format.

Parameters

$value

(array) (Required) Widget instance to convert to JSON.

Return

(array) JSON-converted widget instance.

Source

File: wp-includes/class-wp-customize-widgets.php

public function sanitize_widget_js_instance( $value ) {
		if ( empty( $value['is_widget_customizer_js_value'] ) ) {
			$serialized = serialize( $value );

			$value = array(
				'encoded_serialized_instance'   => base64_encode( $serialized ),
				'title'                         => empty( $value['title'] ) ? '' : $value['title'],
				'is_widget_customizer_js_value' => true,
				'instance_hash_key'             => $this->get_instance_hash_key( $serialized ),
			);
		}
		return $value;
	}

Changelog

Version Description
3.9.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_customize_widgets/sanitize_widget_js_instance