WP_REST_Font_Families_Controller::get_endpoint_args_for_item_schema( $method = WP_REST_Server::CREATABLE ): array

In this article

Get the arguments used when creating or updating a font family.

Return

array Font family create/edit arguments.

Source

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 );
}

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

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