WP_REST_Font_Families_Controller::sanitize_font_family_settings( string $value ): array

In this article

Sanitizes the font family settings when creating or updating a font family.

Parameters

$valuestringrequired
Encoded JSON string of font family settings.

Return

array Decoded array of font family settings.

Source

public function sanitize_font_family_settings( $value ) {
	// Settings arrive as stringified JSON, since this is a multipart/form-data request.
	$settings = json_decode( $value, true );
	$schema   = $this->get_item_schema()['properties']['font_family_settings']['properties'];

	// Sanitize settings based on callbacks in the schema.
	foreach ( $settings as $key => $value ) {
		$sanitize_callback = $schema[ $key ]['arg_options']['sanitize_callback'];
		$settings[ $key ]  = call_user_func( $sanitize_callback, $value );
	}

	return $settings;
}

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.