Automattic\WooCommerce\Admin\API

Notes::get_item_schema()publicWC 1.0

Get the note's schema, conforming to JSON Schema.

Method of the class: Notes{}

No Hooks.

Return

Array.

Usage

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

Notes::get_item_schema() code WC 8.7.0

public function get_item_schema() {
	$schema = array(
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'note',
		'type'       => 'object',
		'properties' => array(
			'id'                => array(
				'description' => __( 'ID of the note record.', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'name'              => array(
				'description' => __( 'Name of the note.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'type'              => array(
				'description' => __( 'The type of the note (e.g. error, warning, etc.).', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'locale'            => array(
				'description' => __( 'Locale used for the note title and content.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'title'             => array(
				'description' => __( 'Title of the note.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'content'           => array(
				'description' => __( 'Content of the note.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'content_data'      => array(
				'description' => __( 'Content data for the note. JSON string. Available for re-localization.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'status'            => array(
				'description' => __( 'The status of the note (e.g. unactioned, actioned).', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
			),
			'source'            => array(
				'description' => __( 'Source of the note.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'date_created'      => array(
				'description' => __( 'Date the note was created.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'date_created_gmt'  => array(
				'description' => __( 'Date the note was created (GMT).', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'date_reminder'     => array(
				'description' => __( 'Date after which the user should be reminded of the note, if any.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true, // @todo Allow date_reminder to be updated.
			),
			'date_reminder_gmt' => array(
				'description' => __( 'Date after which the user should be reminded of the note, if any (GMT).', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'is_snoozable'      => array(
				'description' => __( 'Whether or not a user can request to be reminded about the note.', 'woocommerce' ),
				'type'        => 'boolean',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'actions'           => array(
				'description' => __( 'An array of actions, if any, for the note.', 'woocommerce' ),
				'type'        => 'array',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'layout'            => array(
				'description' => __( 'The layout of the note (e.g. banner, thumbnail, plain).', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'image'             => array(
				'description' => __( 'The image of the note, if any.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'is_deleted'        => array(
				'description' => __( 'Registers whether the note is deleted or not', 'woocommerce' ),
				'type'        => 'boolean',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'is_read'           => array(
				'description' => __( 'Registers whether the note is read or not', 'woocommerce' ),
				'type'        => 'boolean',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
		),
	);
	return $this->add_additional_fields_schema( $schema );
}