WP_REST_Font_Families_Controller::get_endpoint_args_for_item_schema()publicWP 6.5.0

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

Метод класса: WP_REST_Font_Families_Controller{}

Хуков нет.

Возвращает

Массив. Font family create/edit arguments.

Использование

$WP_REST_Font_Families_Controller = new WP_REST_Font_Families_Controller();
$WP_REST_Font_Families_Controller->get_endpoint_args_for_item_schema( $method );
$method **
-
По умолчанию: WP_REST_Server::CREATABLE

Список изменений

С версии 6.5.0 Введена.

Код WP_REST_Font_Families_Controller::get_endpoint_args_for_item_schema() WP 6.7.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 );
}