Automattic\WooCommerce\Admin\API

OnboardingThemes::get_recommended_item_schema()publicWC 1.0

Get the recommended themes schema, conforming to JSON Schema.

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

Хуков нет.

Возвращает

Массив.

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

$OnboardingThemes = new OnboardingThemes();
$OnboardingThemes->get_recommended_item_schema();

Код OnboardingThemes::get_recommended_item_schema() WC 9.3.3

public function get_recommended_item_schema() {
	$schema = array(
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'onboarding_theme',
		'type'       => 'object',
		'properties' => array(
			'themes' => array(
				'type'  => 'array',
				'items' => array(
					'type'       => 'object',
					'properties' => array(
						'name'           => array(
							'type'        => 'string',
							'description' => 'Theme Name',
						),
						'price'          => array(
							'type'        => 'string',
							'description' => 'Price',
						),
						'is_free'        => array(
							'type'        => 'boolean',
							'description' => 'Whether theme is free',
						),
						'is_active'      => array(
							'type'        => 'boolean',
							'description' => 'Whether theme is active',
						),
						'thumbnail_url'  => array(
							'type'        => 'string',
							'description' => 'Thumbnail URL',
						),
						'link_url'       => array(
							'type'        => 'string',
							'description' => 'Link URL for the theme',
						),
						'color_palettes' => array(
							'type'        => 'array',
							'description' => 'Array of color palette objects',
							'items'       => array(
								'type'       => 'object',
								'properties' => array(
									'primary'   => array(
										'type'        => 'string',
										'description' => 'Primary color',
									),
									'secondary' => array(
										'type'        => 'string',
										'description' => 'Secondary color',
									),
								),
							),
						),
					),
				),
			),
			'_links' => array(
				'type'        => 'object',
				'description' => 'Links related to this response',
				'properties'  => array(
					'browse_all' => array(
						'type'        => 'object',
						'description' => 'Link to browse all themes',
						'properties'  => array(
							'href' => array(
								'type'        => 'string',
								'description' => 'URL for browsing all themes',
							),
						),
					),
				),
			),
		),
	);

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