Prepares a single font face post for creation.
Parameters
$request
WP_REST_Requestrequired- Request object.
Source
protected function prepare_item_for_database( $request ) {
$prepared_post = new stdClass();
// Settings have already been decoded by ::sanitize_font_face_settings().
$settings = $request->get_param( 'font_face_settings' );
// Store this "slug" as the post_title rather than post_name, since it uses the fontFamily setting,
// which may contain multibyte characters.
$title = WP_Font_Utils::get_font_face_slug( $settings );
$prepared_post->post_type = $this->post_type;
$prepared_post->post_parent = $request['font_family_id'];
$prepared_post->post_status = 'publish';
$prepared_post->post_title = $title;
$prepared_post->post_name = sanitize_title( $title );
$prepared_post->post_content = wp_json_encode( $settings );
return $prepared_post;
}
Changelog
Version | Description |
---|---|
6.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.