WP_Font_Collection::get_sanitization_schema(): array

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Retrieves the font collection sanitization schema.

Return

array Font collection sanitization schema.

Source

private static function get_sanitization_schema() {
	return array(
		'name'          => 'sanitize_text_field',
		'description'   => 'sanitize_text_field',
		'font_families' => array(
			array(
				'font_family_settings' => array(
					'name'       => 'sanitize_text_field',
					'slug'       => static function ( $value ) {
						return _wp_to_kebab_case( sanitize_title( $value ) );
					},
					'fontFamily' => 'WP_Font_Utils::sanitize_font_family',
					'preview'    => 'sanitize_url',
					'fontFace'   => array(
						array(
							'fontFamily'            => 'sanitize_text_field',
							'fontStyle'             => 'sanitize_text_field',
							'fontWeight'            => 'sanitize_text_field',
							'src'                   => static function ( $value ) {
								return is_array( $value )
									? array_map( 'sanitize_text_field', $value )
									: sanitize_text_field( $value );
							},
							'preview'               => 'sanitize_url',
							'fontDisplay'           => 'sanitize_text_field',
							'fontStretch'           => 'sanitize_text_field',
							'ascentOverride'        => 'sanitize_text_field',
							'descentOverride'       => 'sanitize_text_field',
							'fontVariant'           => 'sanitize_text_field',
							'fontFeatureSettings'   => 'sanitize_text_field',
							'fontVariationSettings' => 'sanitize_text_field',
							'lineGapOverride'       => 'sanitize_text_field',
							'sizeAdjust'            => 'sanitize_text_field',
							'unicodeRange'          => 'sanitize_text_field',
						),
					),
				),
				'categories'           => array( 'sanitize_title' ),
			),
		),
		'categories'    => array(
			array(
				'name' => 'sanitize_text_field',
				'slug' => 'sanitize_title',
			),
		),
	);
}

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

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