Automattic\WooCommerce\Admin\API

MarketingCampaignTypes::get_item_schema()publicWC 1.0

Retrieves the item's schema, conforming to JSON Schema.

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

Хуков нет.

Возвращает

Массив. Item schema data.

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

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

Код MarketingCampaignTypes::get_item_schema() WC 9.7.1

public function get_item_schema() {
	$schema = [
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'marketing_campaign_type',
		'type'       => 'object',
		'properties' => [
			'id'          => [
				'description' => __( 'The unique identifier for the marketing campaign type.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => [ 'view' ],
				'readonly'    => true,
			],
			'name'        => [
				'description' => __( 'Name of the marketing campaign type.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => [ 'view' ],
				'readonly'    => true,
			],
			'description' => [
				'description' => __( 'Description of the marketing campaign type.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => [ 'view' ],
				'readonly'    => true,
			],
			'channel'     => [
				'description' => __( 'The marketing channel that this campaign type belongs to.', 'woocommerce' ),
				'type'        => 'object',
				'context'     => [ 'view' ],
				'readonly'    => true,
				'properties'  => [
					'slug' => [
						'description' => __( 'The unique identifier of the marketing channel that this campaign type belongs to.', 'woocommerce' ),
						'type'        => 'string',
						'context'     => [ 'view' ],
						'readonly'    => true,
					],
					'name' => [
						'description' => __( 'The name of the marketing channel that this campaign type belongs to.', 'woocommerce' ),
						'type'        => 'string',
						'context'     => [ 'view' ],
						'readonly'    => true,
					],
				],
			],
			'create_url'  => [
				'description' => __( 'URL to the create campaign page for this campaign type.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => [ 'view' ],
				'readonly'    => true,
			],
			'icon_url'    => [
				'description' => __( 'URL to an image/icon for the campaign type.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => [ 'view' ],
				'readonly'    => true,
			],
		],
	];

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