WC_REST_Email_Settings_V4_Controller::get_item_schemapublicWC 1.0

Get the schema for email settings, conforming to JSON Schema.

Method of the class: WC_REST_Email_Settings_V4_Controller{}

No Hooks.

Returns

Array.

Usage

$WC_REST_Email_Settings_V4_Controller = new WC_REST_Email_Settings_V4_Controller();
$WC_REST_Email_Settings_V4_Controller->get_item_schema();

WC_REST_Email_Settings_V4_Controller::get_item_schema() code WC 10.3.6

public function get_item_schema() {
	$schema = array(
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'email_settings',
		'type'       => 'object',
		'properties' => array(
			'id'                                 => array(
				'description' => __( 'Unique identifier for the settings group.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'title'                              => array(
				'description' => __( 'Settings title.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'description'                        => array(
				'description' => __( 'Settings description.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'values'                             => array(
				'description' => __( 'Flattened setting values.', 'woocommerce' ),
				'type'        => 'object',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'groups'                             => array(
				'description'          => __( 'Collection of setting groups.', 'woocommerce' ),
				'type'                 => 'object',
				'context'              => array( 'view', 'edit' ),
				'additionalProperties' => array(
					'type'        => 'object',
					'description' => __( 'Settings group.', 'woocommerce' ),
					'properties'  => array(
						'title'       => array(
							'description' => __( 'Group title.', 'woocommerce' ),
							'type'        => 'string',
							'context'     => array( 'view', 'edit' ),
						),
						'description' => array(
							'description' => __( 'Group description.', 'woocommerce' ),
							'type'        => 'string',
							'context'     => array( 'view', 'edit' ),
						),
						'order'       => array(
							'description' => __( 'Display order for the group.', 'woocommerce' ),
							'type'        => 'integer',
							'context'     => array( 'view', 'edit' ),
							'readonly'    => true,
						),
						'fields'      => array(
							'description' => __( 'Settings fields.', 'woocommerce' ),
							'type'        => 'array',
							'context'     => array( 'view', 'edit' ),
							'items'       => $this->get_field_schema(),
						),
					),
				),
			),
			'woocommerce_email_from_name'        => array(
				'description' => __( 'Email sender name.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
			),
			'woocommerce_email_from_address'     => array(
				'description' => __( 'Email sender address.', 'woocommerce' ),
				'type'        => 'string',
				'format'      => 'email',
				'context'     => array( 'view', 'edit' ),
			),
			'woocommerce_email_reply_to_enabled' => array(
				'description' => __( 'Enable reply-to email address.', 'woocommerce' ),
				'type'        => 'boolean',
				'context'     => array( 'view', 'edit' ),
			),
			'woocommerce_email_reply_to_name'    => array(
				'description' => __( 'Reply-to name.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
			),
			'woocommerce_email_reply_to_address' => array(
				'description' => __( 'Reply-to email address.', 'woocommerce' ),
				'type'        => 'string',
				'format'      => 'email',
				'context'     => array( 'view', 'edit' ),
			),
		),
	);

	return $this->add_additional_fields_schema( $schema );
}