Automattic\WooCommerce\Admin\API

MarketingRecommendations::get_item_schema()publicWC 1.0

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

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

Хуков нет.

Возвращает

Массив. Item schema data.

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

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

Код MarketingRecommendations::get_item_schema() WC 9.7.1

public function get_item_schema() {
	$schema = [
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'marketing_recommendation',
		'type'       => 'object',
		'properties' => [
			'title'          => [
				'type'     => 'string',
				'context'  => [ 'view' ],
				'readonly' => true,
			],
			'description'    => [
				'type'     => 'string',
				'context'  => [ 'view' ],
				'readonly' => true,
			],
			'url'            => [
				'type'     => 'string',
				'context'  => [ 'view' ],
				'readonly' => true,
			],
			'direct_install' => [
				'type'     => 'string',
				'context'  => [ 'view' ],
				'readonly' => true,
			],
			'icon'           => [
				'type'     => 'string',
				'context'  => [ 'view' ],
				'readonly' => true,
			],
			'product'        => [
				'type'     => 'string',
				'context'  => [ 'view' ],
				'readonly' => true,
			],
			'plugin'         => [
				'type'     => 'string',
				'context'  => [ 'view' ],
				'readonly' => true,
			],
			'categories'     => [
				'type'     => 'array',
				'context'  => [ 'view' ],
				'readonly' => true,
				'items'    => [
					'type' => 'string',
				],
			],
			'subcategories'  => [
				'type'     => 'array',
				'context'  => [ 'view' ],
				'readonly' => true,
				'items'    => [
					'type'       => 'object',
					'context'    => [ 'view' ],
					'readonly'   => true,
					'properties' => [
						'slug' => [
							'type'     => 'string',
							'context'  => [ 'view' ],
							'readonly' => true,
						],
						'name' => [
							'type'     => 'string',
							'context'  => [ 'view' ],
							'readonly' => true,
						],
					],
				],
			],
			'tags'           => [
				'type'     => 'array',
				'context'  => [ 'view' ],
				'readonly' => true,
				'items'    => [
					'type'       => 'object',
					'context'    => [ 'view' ],
					'readonly'   => true,
					'properties' => [
						'slug' => [
							'type'     => 'string',
							'context'  => [ 'view' ],
							'readonly' => true,
						],
						'name' => [
							'type'     => 'string',
							'context'  => [ 'view' ],
							'readonly' => true,
						],
					],
				],
			],
		],
	];

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