Automattic\WooCommerce\Internal\RestApi\Routes\V4\Settings\Tax\Schema

TaxSettingsSchema::get_field_schemaprivateWC 1.0

Get the schema for individual setting fields.

Method of the class: TaxSettingsSchema{}

No Hooks.

Returns

Array.

Usage

// private - for code of main (parent) class only
$result = $this->get_field_schema(): array;

TaxSettingsSchema::get_field_schema() code WC 10.4.3

private function get_field_schema(): array {
	return array(
		'type'       => 'object',
		'properties' => array(
			'id'      => array(
				'description' => __( 'Setting field ID.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => self::VIEW_EDIT_CONTEXT,
			),
			'label'   => array(
				'description' => __( 'Setting field label.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => self::VIEW_EDIT_CONTEXT,
			),
			'type'    => array(
				'description' => __( 'Setting field type.', 'woocommerce' ),
				'type'        => 'string',
				'enum'        => array( 'text', 'number', 'select', 'multiselect', 'checkbox', 'radio', 'textarea' ),
				'context'     => self::VIEW_EDIT_CONTEXT,
			),
			'options' => array(
				'description' => __( 'Available options for select/radio fields.', 'woocommerce' ),
				'type'        => 'object',
				'context'     => self::VIEW_EDIT_CONTEXT,
			),
			'desc'    => array(
				'description' => __( 'Description for the setting field.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => self::VIEW_EDIT_CONTEXT,
			),
		),
	);
}