WP_REST_Font_Faces_Controller::sanitize_font_face_settings()
Sanitizes the font face settings when creating a font face.
Method of the class: WP_REST_Font_Faces_Controller{}
No Hooks.
Return
Array
. Decoded and sanitized array of font face settings.
Usage
$WP_REST_Font_Faces_Controller = new WP_REST_Font_Faces_Controller(); $WP_REST_Font_Faces_Controller->sanitize_font_face_settings( $value );
- $value(string) (required)
- Encoded JSON string of font face settings.
Changelog
Since 6.5.0 | Introduced. |
WP_REST_Font_Faces_Controller::sanitize_font_face_settings() WP REST Font Faces Controller::sanitize font face settings code WP 6.6.2
public function sanitize_font_face_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_face_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; }