WP_REST_Font_Families_Controller::get_endpoint_args_for_item_schema
Get the arguments used when creating or updating a font family.
Method of the class: WP_REST_Font_Families_Controller{}
No Hooks.
Returns
Array. Font family create/edit arguments.
Usage
$WP_REST_Font_Families_Controller = new WP_REST_Font_Families_Controller(); $WP_REST_Font_Families_Controller->get_endpoint_args_for_item_schema( $method );
- $method
- .
Default:WP_REST_Server::CREATABLE
Changelog
| Since 6.5.0 | Introduced. |
WP_REST_Font_Families_Controller::get_endpoint_args_for_item_schema() WP REST Font Families Controller::get endpoint args for item schema code WP 6.9.1
public function get_endpoint_args_for_item_schema( $method = WP_REST_Server::CREATABLE ) {
if ( WP_REST_Server::CREATABLE === $method || WP_REST_Server::EDITABLE === $method ) {
$properties = $this->get_item_schema()['properties'];
return array(
'theme_json_version' => $properties['theme_json_version'],
// When creating or updating, font_family_settings is stringified JSON, to work with multipart/form-data.
// Font families don't currently support file uploads, but may accept preview files in the future.
'font_family_settings' => array(
'description' => __( 'font-family declaration in theme.json format, encoded as a string.' ),
'type' => 'string',
'required' => true,
'validate_callback' => array( $this, 'validate_font_family_settings' ),
'sanitize_callback' => array( $this, 'sanitize_font_family_settings' ),
),
);
}
return parent::get_endpoint_args_for_item_schema( $method );
}